From: Mikel Astiz <mikel.astiz.oss@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Mikel Astiz <mikel.astiz@bmw-carit.de>
Subject: [PATCH v2 2/6] audio: Fix crash on gateway close
Date: Tue, 25 Sep 2012 16:55:42 +0200 [thread overview]
Message-ID: <1348584946-13895-3-git-send-email-mikel.astiz.oss@gmail.com> (raw)
In-Reply-To: <1348584946-13895-1-git-send-email-mikel.astiz.oss@gmail.com>
From: Mikel Astiz <mikel.astiz@bmw-carit.de>
gateway_close() can be called multiple times and thus the code must
handle the case where device->gateway is already NULL.
This issue can be easily reproduced if a device is removed (unpaired)
while HFP gateway is connected.
---
audio/gateway.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/audio/gateway.c b/audio/gateway.c
index 45b25a1..93a70ba 100644
--- a/audio/gateway.c
+++ b/audio/gateway.c
@@ -566,6 +566,9 @@ int gateway_close(struct audio_device *device)
struct gateway *gw = device->gateway;
int sock;
+ if (gw == NULL)
+ return 0;
+
if (gw->rfcomm) {
sock = g_io_channel_unix_get_fd(gw->rfcomm);
shutdown(sock, SHUT_RDWR);
--
1.7.11.4
next prev parent reply other threads:[~2012-09-25 14:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-25 14:55 [PATCH v2 0/6] Audio profile authorization Mikel Astiz
2012-09-25 14:55 ` [PATCH v2 1/6] build: Update glib dependency to 2.32 Mikel Astiz
2012-09-25 14:55 ` Mikel Astiz [this message]
2012-09-27 8:00 ` [PATCH v2 2/6] audio: Fix crash on gateway close Luiz Augusto von Dentz
2012-09-25 14:55 ` [PATCH v2 3/6] adapter: Replace device authorizing flag Mikel Astiz
2012-09-25 14:55 ` [PATCH v2 4/6] adapter: Use authorization id for cancelling Mikel Astiz
2012-09-25 14:55 ` [PATCH v2 5/6] adapter: Queue parallel authorization requests Mikel Astiz
2012-09-25 14:55 ` [PATCH v2 6/6] audio: Drop audio-specific authorization mechanism Mikel Astiz
2012-09-27 8:00 ` [PATCH v2 0/6] Audio profile authorization Luiz Augusto von Dentz
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=1348584946-13895-3-git-send-email-mikel.astiz.oss@gmail.com \
--to=mikel.astiz.oss@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=mikel.astiz@bmw-carit.de \
/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