public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Bastien Nocera <hadess@hadess.net>
To: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: bluetoothd crasher
Date: Wed, 24 Sep 2008 16:55:35 -0700	[thread overview]
Message-ID: <1222300535.10497.198.camel@snoogens.fab.redhat.com> (raw)
In-Reply-To: <1222298318.10497.187.camel@snoogens.fab.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 276 bytes --]

On Wed, 2008-09-24 at 16:18 -0700, Bastien Nocera wrote:
> On Wed, 2008-09-24 at 16:09 -0700, Bastien Nocera wrote:
> > Heya,
> > 
> > The current bluetoothd crashes on resume from suspend. Here's the valgrind output:

Patch attached, thanks to Johan for helping out.

Cheers

[-- Attachment #2: bluez-bluetoothd-crasher.patch --]
[-- Type: text/x-patch, Size: 1330 bytes --]

diff --git a/src/security.c b/src/security.c
index fd2535f..6a9a5c4 100644
--- a/src/security.c
+++ b/src/security.c
@@ -46,6 +46,7 @@
 
 #include <dbus/dbus.h>
 
+#include "hcid.h"
 #include "logging.h"
 #include "textfile.h"
 
@@ -789,6 +790,27 @@ static inline void conn_request(int dev, bdaddr_t *sba, void *ptr)
 	write_remote_class(sba, &evt->bdaddr, class);
 }
 
+static void delete_channel(GIOChannel *chan)
+{
+	gint i, found;
+
+	/* Look for the GIOChannel in the table */
+	found = -1;
+	for (i = 0; i < HCI_MAX_DEV; i++) {
+		if (io_data[i].channel == chan) {
+			found = i;
+			break;
+		}
+	}
+
+	if (found == -1) {
+		g_warning("IO channel not found in the io_data table");
+		return;
+	}
+
+	stop_security_manager(i);
+}
+
 static gboolean io_security_event(GIOChannel *chan, GIOCondition cond, gpointer data)
 {
 	unsigned char buf[HCI_MAX_EVENT_SIZE], *ptr = buf;
@@ -799,14 +821,14 @@ static gboolean io_security_event(GIOChannel *chan, GIOCondition cond, gpointer
 	GIOError err;
 
 	if (cond & (G_IO_NVAL | G_IO_HUP | G_IO_ERR)) {
-		g_io_channel_unref(chan);
+		delete_channel(chan);
 		return FALSE;
 	}
 
 	if ((err = g_io_channel_read(chan, (gchar *) buf, sizeof(buf), &len))) {
 		if (err == G_IO_ERROR_AGAIN)
 			return TRUE;
-		g_io_channel_unref(chan);
+		delete_channel(chan);
 		return FALSE;
 	}
 

  reply	other threads:[~2008-09-24 23:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-24 23:09 bluetoothd crasher Bastien Nocera
2008-09-24 23:18 ` Bastien Nocera
2008-09-24 23:55   ` Bastien Nocera [this message]
2008-09-25  0:13     ` Marcel Holtmann

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=1222300535.10497.198.camel@snoogens.fab.redhat.com \
    --to=hadess@hadess.net \
    --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