linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gix, Brian" <brian.gix@intel.com>
To: "linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>,
	"Stotland, Inga" <inga.stotland@intel.com>
Cc: "istotlan@ingas-xps13.amr.corp.intel.com" 
	<istotlan@ingas-xps13.amr.corp.intel.com>
Subject: Re: [PATCH BlueZ] mesh: Fix segmentation fault on Join() call
Date: Sat, 5 Oct 2019 16:14:13 +0000	[thread overview]
Message-ID: <20fd4bb031257b375840767940315af8c2aab6f3.camel@intel.com> (raw)
In-Reply-To: <20191001185108.5656-1-inga.stotland@intel.com>

Applied

On Tue, 2019-10-01 at 11:51 -0700, Inga Stotland wrote:
> From: Inga Stotland <istotlan@ingas-xps13.amr.corp.intel.com>
> 
> 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;
>  

      reply	other threads:[~2019-10-05 16:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-01 18:51 [PATCH BlueZ] mesh: Fix segmentation fault on Join() call Inga Stotland
2019-10-05 16:14 ` Gix, Brian [this message]

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=20fd4bb031257b375840767940315af8c2aab6f3.camel@intel.com \
    --to=brian.gix@intel.com \
    --cc=inga.stotland@intel.com \
    --cc=istotlan@ingas-xps13.amr.corp.intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).