[PATCH] Fix" introduced in 2.4.27pre2 for bluetooth hci_usb race causes kernel hang
Linux Kernel Mailing List <[email protected]> Sun, 19 Jun 2005 04:56:20 -0700
| Newsgroups | gmane.linux.kernel.commits.2-4 |
|---|---|
| Message-ID | <[email protected]> |
tree c7737a3547f1135bd8ee8a0d559c43ef2fba484e parent 284ce8b6e650e54a0348ebecb6c05d5acc899e56 author Marcel Holtmann <[email protected]> Wed, 13 Apr 2005 23:28:09 +0200 committer Marcelo Tosatti <[email protected]> Fri, 03 Jun 2005 00:03:57 -0300 [PATCH] Fix" introduced in 2.4.27pre2 for bluetooth hci_usb race causes kernel hang > I have noticed a problem with a race condition fix introduced in > 2.4.27-pre2 that causes the kernel to hang when disconnecting a > Bluetooth USB dongle or doing 'hciconfig hci0 down'. No message is > printed, the kernel just doesn't respond anymore. if this works then we should do the same change in the bfusb driver. A patch that fixes both drivers is attached. drivers/bluetooth/bfusb.c | 3 +-- drivers/bluetooth/hci_usb.c | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c --- a/drivers/bluetooth/bfusb.c +++ b/drivers/bluetooth/bfusb.c @@ -470,12 +470,11 @@ static int bfusb_close(struct hci_dev *h return 0; write_lock_irqsave(&bfusb->lock, flags); + write_unlock_irqrestore(&bfusb->lock, flags); bfusb_unlink_urbs(bfusb); bfusb_flush(hdev); - write_unlock_irqrestore(&bfusb->lock, flags); - MOD_DEC_USE_COUNT; return 0; diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c --- a/drivers/bluetooth/hci_usb.c +++ b/drivers/bluetooth/hci_usb.c @@ -398,13 +398,13 @@ static int hci_usb_close(struct hci_dev BT_DBG("%s", hdev->name); + /* Synchronize with completion handlers */ write_lock_irqsave(&husb->completion_lock, flags); - + write_unlock_irqrestore(&husb->completion_lock, flags); + hci_usb_unlink_urbs(husb); hci_usb_flush(hdev); - write_unlock_irqrestore(&husb->completion_lock, flags); - MOD_DEC_USE_COUNT; return 0; }