Hi Tomas,

> 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.
> 
> Seen in Changelog:
> Marcel Holtmann:
>   o [Bluetooth] Fix race in RX complete routine of the USB drivers
> 
> Reversing the following patch to hci_usb_rx_complete() makes 2.4.27-pre2
> up until 2.4.30 happy and does not hang when removing the dongle
> anymore. (bfusb.c has the same patch applied)
> 
> 2.6.11.7 does not show the same problem, but has similar code to the
> "fixed" (that hangs) code in 2.4, so the real problem is probably
> somewhere else.

does the attached patch makes any difference?

Regards

Marcel

===== drivers/bluetooth/hci_usb.c 1.23 vs edited =====
--- 1.23/drivers/bluetooth/hci_usb.c    2004-07-31 13:02:43 +02:00
+++ edited/drivers/bluetooth/hci_usb.c  2005-04-09 15:37:12 +02:00
@@ -398,12 +398,12 @@
 
        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;

Reply via email to