From: Alexander Holler <holler@ahsoftware.de>
To: linux-bluetooth@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: bluetooth: fix deadlock on device reset and power down
Date: Sat, 31 Mar 2012 15:23:38 +0200 [thread overview]
Message-ID: <4F77055A.2070502@ahsoftware.de> (raw)
Hello,
I've experienced a deadlock on shutdown using kernel 3.3 and tracked it
down. Because I'm not very familiar with the bluetooth stack I'm not
sure if the below patch is correct, but it fixed the problem here.
This patch should go to the stable tree too, if approved.
Regards,
Alexander
--------------
From 9d0902dc07504ab28a31de471cfb3225fb0404c6 Mon Sep 17 00:00:00 2001
From: Alexander Holler <holler@ahsoftware.de>
Date: Sat, 31 Mar 2012 15:03:27 +0200
Subject: [PATCH] bluetooth: fix deadlock on device reset and power down
Commit 09fd0de5bd8f8ef3317e5365f92f1a13dcd89aa9 introduced a deadlock:
bluetoothd calls ioctl HCIDEVDOWN
hci_sock_ioctl()
hci_dev_close()
hci_dev_do_close()
hci_dev_lock(hdev);
inquiry_cache_flush();
hci_conn_hash_flush();
hci_conn_del()
cancel_delayed_work_sync()
hci_conn_timeout()
hci_dev_lock(hdev); /* DEADLOCK */
hci_dev_unlock(hdev);
Signed-off-by: Alexander Holler <holler@ahsoftware.de>
---
net/bluetooth/hci_core.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 5aeb624..3428036 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -629,8 +629,8 @@ static int hci_dev_do_close(struct hci_dev *hdev)
hci_dev_lock(hdev);
inquiry_cache_flush(hdev);
- hci_conn_hash_flush(hdev);
hci_dev_unlock(hdev);
+ hci_conn_hash_flush(hdev);
hci_notify(hdev, HCI_DEV_DOWN);
@@ -713,8 +713,8 @@ int hci_dev_reset(__u16 dev)
hci_dev_lock(hdev);
inquiry_cache_flush(hdev);
- hci_conn_hash_flush(hdev);
hci_dev_unlock(hdev);
+ hci_conn_hash_flush(hdev);
if (hdev->flush)
hdev->flush(hdev);
--
1.7.6.5
next reply other threads:[~2012-03-31 13:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-31 13:23 Alexander Holler [this message]
2012-04-02 6:55 ` bluetooth: fix deadlock on device reset and power down Andrei Emeltchenko
2012-04-02 8:29 ` Alexander Holler
2012-04-02 8:44 ` David Herrmann
2012-04-02 9:03 ` Andrei Emeltchenko
2012-04-02 9:17 ` Alexander Holler
2012-04-02 10:16 ` Alexander Holler
2012-04-02 13:52 ` Andre Guedes
2012-04-02 14:27 ` Genes MailLists
2012-04-03 8:37 ` Alexander Holler
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=4F77055A.2070502@ahsoftware.de \
--to=holler@ahsoftware.de \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@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;
as well as URLs for NNTP newsgroup(s).