Linux-Bluetooth Archive on lore.kernel.org
 help / color / Atom feed
From: Prathyusha Nelluri <prathyusha.n@samsung.com>
To: linux-bluetooth@vger.kernel.org
Cc: s.syam@samsung.com, Prathyusha N <prathyusha.n@samsung.com>
Subject: [PATCH 1/1] mesh: Add mesh agent cleanup to mesh cleanup
Date: Wed, 25 Mar 2020 00:57:15 +0530
Message-ID: <1585078044-14974-1-git-send-email-prathyusha.n@samsung.com> (raw)
In-Reply-To: <CGME20200324192821epcas5p3e756863feafcf1f8eab993a237c19521@epcas5p3.samsung.com>

From: Prathyusha N <prathyusha.n@samsung.com>

Freed agent completely in agent_free(). Removed agent from queue
after app disconnects in provisioner case. Linked agent to
join_pending so that agent gets freed after every join call.
Added mesh_agent_cleanup in mesh_cleanup to clear and free
agents queue.
---
 mesh/agent.c   | 3 ++-
 mesh/manager.c | 1 +
 mesh/mesh.c    | 2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/mesh/agent.c b/mesh/agent.c
index 3ab3893a1..ec49c37d0 100644
--- a/mesh/agent.c
+++ b/mesh/agent.c
@@ -205,6 +205,7 @@ static void agent_free(void *agent_data)
 
 	l_free(agent->path);
 	l_free(agent->owner);
+	l_free(agent);
 }
 
 void mesh_agent_remove(struct mesh_agent *agent)
@@ -212,8 +213,8 @@ void mesh_agent_remove(struct mesh_agent *agent)
 	if (!agent || !l_queue_find(agents, simple_match, agent))
 		return;
 
-	agent_free(agent);
 	l_queue_remove(agents, agent);
+	agent_free(agent);
 }
 
 void mesh_agent_cleanup(void)
diff --git a/mesh/manager.c b/mesh/manager.c
index e4a7deaeb..0b6511b4a 100644
--- a/mesh/manager.c
+++ b/mesh/manager.c
@@ -92,6 +92,7 @@ static void prov_disc_cb(struct l_dbus *bus, void *user_data)
 	initiator_cancel(add_pending);
 	add_pending->disc_watch = 0;
 
+	mesh_agent_remove(add_pending->agent);
 	free_pending_add_call();
 }
 
diff --git a/mesh/mesh.c b/mesh/mesh.c
index 6d2f86b6d..caabab508 100644
--- a/mesh/mesh.c
+++ b/mesh/mesh.c
@@ -336,6 +336,7 @@ void mesh_cleanup(void)
 	l_queue_destroy(pending_queue, pending_request_exit);
 	node_cleanup_all();
 	mesh_model_cleanup();
+	mesh_agent_cleanup();
 
 	l_dbus_object_remove_interface(dbus_get_bus(), BLUEZ_MESH_PATH,
 							MESH_NETWORK_INTERFACE);
@@ -480,6 +481,7 @@ static void node_init_cb(struct mesh_node *node, struct mesh_agent *agent)
 	}
 
 	join_pending->node = node;
+	join_pending->agent = agent;
 	num_ele = node_get_num_elements(node);
 
 	if (!acceptor_start(num_ele, join_pending->uuid, mesh.algorithms,
-- 
2.17.1


       reply index

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200324192821epcas5p3e756863feafcf1f8eab993a237c19521@epcas5p3.samsung.com>
2020-03-24 19:27 ` Prathyusha Nelluri [this message]
     [not found]   ` <CGME20200324192820epcas5p10a4ae9a6d7e7dab22f4a5ab4ee752099@epcas5p1.samsung.com>
2020-03-24 19:27     ` [PATCH 1/1] mesh: Check limits for count and interval of relay Prathyusha Nelluri
2020-03-25 19:12       ` Gix, Brian
2020-03-26 17:02         ` Gix, Brian
     [not found]   ` <CGME20200324192821epcas5p1cc8182aac6ed0b096c76e3ccbd269688@epcas5p1.samsung.com>
2020-03-24 19:27     ` [PATCH 1/1] mesh: Handle close for Acceptor Prathyusha Nelluri
     [not found]   ` <CGME20200324192822epcas5p2986c35616c596051bb7826457439c893@epcas5p2.samsung.com>
2020-03-24 19:27     ` [PATCH 1/1] mesh: Handle invalid public keys Prathyusha Nelluri
2020-03-26 17:03       ` Gix, Brian
     [not found]   ` <CGME20200324192823epcas5p3b25363353b98e206a50d7fd4572c9552@epcas5p3.samsung.com>
2020-03-24 19:27     ` [PATCH 1/1] mesh: Handle KeyRefresh phase 1 to phase 3 Prathyusha Nelluri
     [not found]   ` <CGME20200324192824epcas5p4886d88a31b8f9b31eeaf2fa38385698b@epcas5p4.samsung.com>
2020-03-24 19:27     ` [PATCH 1/1] mesh: Handle KeyRefresh phase set to 3 Prathyusha Nelluri
     [not found]   ` <CGME20200324192824epcas5p1de37a38491d79ea6dca2cc5da50cd289@epcas5p1.samsung.com>
2020-03-24 19:27     ` [PATCH 1/1] mesh: Handle netkey delete when netkey is not in netkeylist Prathyusha Nelluri
2020-03-26 17:03       ` Gix, Brian
     [not found]   ` <CGME20200324192825epcas5p4c038b652414de6be433f224a655a2244@epcas5p4.samsung.com>
2020-03-24 19:27     ` [PATCH 1/1] mesh: Initialize local_acked to zero Prathyusha Nelluri
     [not found]   ` <CGME20200324192826epcas5p2eb80e44ac061329faf5421ba3b76e5f8@epcas5p2.samsung.com>
2020-03-24 19:27     ` [PATCH 1/1] mesh: Send input complete for input OOB Authentication Prathyusha Nelluri
2020-03-26 17:02       ` Gix, Brian
     [not found]   ` <CGME20200324192827epcas5p3f70d5e24d6042786ffea8bdbd5ddc8e8@epcas5p3.samsung.com>
2020-03-24 19:27     ` [PATCH 1/1] mesh: Validate Provisioning Start PDU values Prathyusha Nelluri

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1585078044-14974-1-git-send-email-prathyusha.n@samsung.com \
    --to=prathyusha.n@samsung.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=s.syam@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Bluetooth Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-bluetooth/0 linux-bluetooth/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-bluetooth linux-bluetooth/ https://lore.kernel.org/linux-bluetooth \
		linux-bluetooth@vger.kernel.org
	public-inbox-index linux-bluetooth

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-bluetooth


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git