* [PATCH BlueZ v2] mesh: Fix segmentation fault when removing a node
@ 2019-07-04 17:36 Inga Stotland
2019-07-04 18:01 ` Gix, Brian
0 siblings, 1 reply; 2+ messages in thread
From: Inga Stotland @ 2019-07-04 17:36 UTC (permalink / raw)
To: linux-bluetooth
Cc: brian.gix, michal.lowas-rzechonek, jakub.witowski, Inga Stotland
This fixes a segmentation fault introduced by earlier changes.
Segmentation fault was used by accessing a queu that has been
destroyed, but the corresponding pointer hasn't been set to NULL.
---
mesh/node.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mesh/node.c b/mesh/node.c
index ad94d885c..8e9da8988 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -260,12 +260,16 @@ static void free_node_resources(void *data)
/* Unregister io callbacks */
if (node->net)
mesh_net_detach(node->net);
+
mesh_net_free(node->net);
+ node->net = NULL;
l_queue_destroy(node->elements, element_free);
- l_free(node->comp);
+ node->elements = NULL;
free_node_dbus_resources(node);
+
+ l_free(node->comp);
l_free(node);
}
--
2.21.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH BlueZ v2] mesh: Fix segmentation fault when removing a node
2019-07-04 17:36 [PATCH BlueZ v2] mesh: Fix segmentation fault when removing a node Inga Stotland
@ 2019-07-04 18:01 ` Gix, Brian
0 siblings, 0 replies; 2+ messages in thread
From: Gix, Brian @ 2019-07-04 18:01 UTC (permalink / raw)
To: linux-bluetooth, Stotland, Inga; +Cc: michal.lowas-rzechonek, jakub.witowski
Applied with agreed upon minor adjustments, which have been build and
run tested.
On Thu, 2019-07-04 at 10:36 -0700, Inga Stotland wrote:
> This fixes a segmentation fault introduced by earlier changes.
> Segmentation fault was used by accessing a queu that has been
> destroyed, but the corresponding pointer hasn't been set to NULL.
> ---
> mesh/node.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/mesh/node.c b/mesh/node.c
> index ad94d885c..8e9da8988 100644
> --- a/mesh/node.c
> +++ b/mesh/node.c
> @@ -260,12 +260,16 @@ static void free_node_resources(void *data)
> /* Unregister io callbacks */
> if (node->net)
> mesh_net_detach(node->net);
> +
> mesh_net_free(node->net);
> + node->net = NULL;
>
> l_queue_destroy(node->elements, element_free);
> - l_free(node->comp);
> + node->elements = NULL;
>
> free_node_dbus_resources(node);
> +
> + l_free(node->comp);
> l_free(node);
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-04 18:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-04 17:36 [PATCH BlueZ v2] mesh: Fix segmentation fault when removing a node Inga Stotland
2019-07-04 18:01 ` Gix, Brian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).