From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH] Fix possible crash when removing disconnect watches
Date: Mon, 8 Nov 2010 16:43:52 +0200 [thread overview]
Message-ID: <1289227432-13354-1-git-send-email-luiz.dentz@gmail.com> (raw)
From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
The callback may have remove itself before returning.
---
src/device.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/device.c b/src/device.c
index c2b6682..7c421e3 100644
--- a/src/device.c
+++ b/src/device.c
@@ -798,6 +798,10 @@ void device_request_disconnect(struct btd_device *device, DBusMessage *msg)
data->watch(device, device->temporary,
data->user_data);
+ /* Check if the watch has been removed by callback function */
+ if (!g_slist_find(device->watches, data))
+ continue;
+
device->watches = g_slist_remove(device->watches, data);
g_free(data);
}
--
1.7.1
next reply other threads:[~2010-11-08 14:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-08 14:43 Luiz Augusto von Dentz [this message]
2010-11-08 16:15 ` [PATCH] Fix possible crash when removing disconnect watches 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=1289227432-13354-1-git-send-email-luiz.dentz@gmail.com \
--to=luiz.dentz@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