Re: [PATCH BlueZ] mesh: Fix segmentation fault on Join() call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Applied

On Tue, 2019-10-01 at 11:51 -0700, Inga Stotland wrote:
> From: Inga Stotland <istotlan@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
> 
> This fixes the following segfault:
> 
> node_init_cb (node=0x0, agent=0x0) at mesh/mesh.c:359
>         reply = dbus_error(join_pending->msg, MESH_ERROR_FAILED,
> 
>         user_data=0x5555555be170) at mesh/node.c:1760
>         dbus=<optimized out>) at ell/dbus.c:216
>         user_data=0x5555555a6e00) at ell/dbus.c:279
>         user_data=0x5555555a7ef0) at ell/io.c:126
>         at ell/main.c:642
>         at mesh/main.c:205
> 
> The fault was caused by the premature deletion of preserved state.
> 
> This moves setup of disconnect watch for the application calling the Join()
> method into the node_init_cb(), after a temporary node has been
> successfully created.
> ---
>  mesh/mesh.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/mesh/mesh.c b/mesh/mesh.c
> index b660a7ef2..9b2b2073b 100644
> --- a/mesh/mesh.c
> +++ b/mesh/mesh.c
> @@ -377,6 +377,11 @@ static void node_init_cb(struct mesh_node *node, struct mesh_agent *agent)
>  	l_dbus_send(dbus_get_bus(), reply);
>  	join_pending->msg = NULL;
>  
> +	/* Setup disconnect watch */
> +	join_pending->disc_watch = l_dbus_add_disconnect_watch(dbus_get_bus(),
> +						join_pending->sender,
> +						prov_disc_cb, NULL, NULL);
> +
>  	return;
>  
>  fail:
> @@ -423,8 +428,6 @@ static struct l_dbus_message *join_network_call(struct l_dbus *dbus,
>  	sender = l_dbus_message_get_sender(msg);
>  
>  	join_pending->sender = l_strdup(sender);
> -	join_pending->disc_watch = l_dbus_add_disconnect_watch(dbus, sender,
> -						prov_disc_cb, NULL, NULL);
>  	join_pending->msg = l_dbus_message_ref(msg);
>  	join_pending->app_path = app_path;
>  




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux