From: Santiago Carot-Nemesio <sancane@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Santiago Carot-Nemesio <sancane@gmail.com>
Subject: [PATCH] device: Fix segmentation fault removing devices
Date: Tue, 31 Jan 2012 16:59:05 +0100 [thread overview]
Message-ID: <1328025545-14320-1-git-send-email-sancane@gmail.com> (raw)
There is an unbalanced control regarding to the GATT channel and its
attachid, we have to to update the attach id value by setting it to
zero whenever we detach a GATT channel.
---
src/device.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/device.c b/src/device.c
index c19acd4..9f749b7 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1734,6 +1734,7 @@ static void attrib_disconnected(gpointer user_data)
attrib_channel_detach(device->attrib, device->attachid);
g_attrib_unref(device->attrib);
device->attrib = NULL;
+ device->attachid = 0;
if (device->auto_connect == FALSE)
return;
@@ -1781,6 +1782,7 @@ static void primary_cb(GSList *services, guint8 status, gpointer user_data)
if (device->attios == NULL && device->attios_offline == NULL) {
attrib_channel_detach(device->attrib, device->attachid);
+ device->attachid = 0;
g_attrib_unref(device->attrib);
device->attrib = NULL;
} else
@@ -2854,7 +2856,7 @@ gboolean btd_device_remove_attio_callback(struct btd_device *device, guint id)
if (device->attios != NULL || device->attios_offline != NULL)
return TRUE;
- if (device->attachid) {
+ if (device->attachid > 0) {
attrib_channel_detach(device->attrib, device->attachid);
device->attachid = 0;
}
--
1.7.9
next reply other threads:[~2012-01-31 15:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-31 15:59 Santiago Carot-Nemesio [this message]
2012-01-31 16:23 ` [PATCH] device: Fix segmentation fault removing devices Anderson Lizardo
2012-01-31 16:33 ` Santiago Carot
2012-02-02 19:26 ` Claudio Takahasi
2012-02-02 19:58 ` Johan Hedberg
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=1328025545-14320-1-git-send-email-sancane@gmail.com \
--to=sancane@gmail.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