linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* bluetoothd segfault
@ 2011-09-23  8:15 Alberto José Rodríguez Rodríguez
  2011-09-23  9:55 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 2+ messages in thread
From: Alberto José Rodríguez Rodríguez @ 2011-09-23  8:15 UTC (permalink / raw)
  To: linux-bluetooth

Hello Bluetooth experts,

I wrote a program that scan the air for obex capable devices, but I
frequently get a segmentation fault from bluetoothd. The attached file
contains the execution log of bluetoothd using valgrind. Any help will
be appreciated.

http://pastebin.com/9RLeMPPz



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: bluetoothd segfault
  2011-09-23  8:15 bluetoothd segfault Alberto José Rodríguez Rodríguez
@ 2011-09-23  9:55 ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2011-09-23  9:55 UTC (permalink / raw)
  To: Alberto José Rodríguez Rodríguez; +Cc: linux-bluetooth

Ho

2011/9/23 Alberto José Rodríguez Rodríguez <ajrodriguez@blulabs.es>:
> Hello Bluetooth experts,
>
> I wrote a program that scan the air for obex capable devices, but I
> frequently get a segmentation fault from bluetoothd. The attached file
> contains the execution log of bluetoothd using valgrind. Any help will
> be appreciated.
>
> http://pastebin.com/9RLeMPPz

I found at least one possible cause of this, if you are connecting to
multiple devices simultaneously (have multiple ative sdp sessions)
src/glib-helper.c:find_by_bdaddr is broken because it will return 0
(found matching) for all sessions where the adapter matches which can
leads to remove the wrong context and cause a crash like you are
seeing.

In this case you the following patch should fix it:

diff --git a/src/glib-helper.c b/src/glib-helper.c
index 22c14e7..0288c9c 100644
--- a/src/glib-helper.c
+++ b/src/glib-helper.c
@@ -333,9 +333,13 @@ int bt_search_service(const bdaddr_t *src, const
bdaddr_t *dst,
 static gint find_by_bdaddr(gconstpointer data, gconstpointer user_data)
 {
        const struct search_context *ctxt = data, *search = user_data;
+       int ret;

-       return (bacmp(&ctxt->dst, &search->dst) &&
-                                       bacmp(&ctxt->src, &search->src));
+       ret = bacmp(&ctxt->src, &search->src);
+       if (ret != 0)
+               return ret;
+
+       return bacmp(&ctxt->dst, &search->dst);
 }

-- 
Luiz Augusto von Dentz

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-23  9:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-23  8:15 bluetoothd segfault Alberto José Rodríguez Rodríguez
2011-09-23  9:55 ` Luiz Augusto von Dentz

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).