Re: [2.4] "Fix" introduced in 2.4.27pre2 for bluetooth hci_usb race causes kernel hang

From: Marcel Holtmann (marcel_at_holtmann.org)
Date: 04/13/05

  • Next message: Herbert Xu: "Re: [PATCH encrypted swsusp 1/3] core functionality"
    To: Tomas Qgren?= <stric@acc.umu.se>
    Date:	Wed, 13 Apr 2005 23:28:09 +0200
    
    
    

    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?
    >
    > It works just fine with pristine 2.4.30 and this patch. No deadlocks
    > anymore.

    if this works then we should do the same change in the bfusb driver. A
    patch that fixes both drivers is attached.

    Regards

    Marcel

    
    

    ===== drivers/bluetooth/bfusb.c 1.3 vs edited =====
    --- 1.3/drivers/bluetooth/bfusb.c 2004-04-16 14:01:40 +02:00
    +++ edited/drivers/bluetooth/bfusb.c 2005-04-13 12:49:55 +02:00
    @@ -470,11 +470,10 @@
                     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;
     
    ===== 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;

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Herbert Xu: "Re: [PATCH encrypted swsusp 1/3] core functionality"

    Relevant Pages

    • Re: [parisc-linux] Re: [PATCH 3/9] mm: parisc pte atomicity
      ... using your own tmpalias area sounds much better than getting ... I've simply not wrapped my head around the races, ... it looks like we agree that my patch is necessary and valid as is; ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: keyboard - was: Re: Linux 2.6.0-test4
      ... >> I was able to get the key unstuck by switching back and forth between ... I rebuild my kernel including your patch; ... I'll get back to you once I verify that the problem doesn't occur ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: 2.6.0-test8/test9 io scheduler needs tuning?
      ... interactivity with regard to desktop use. ... Going to improve the time info output of the ddd loops to get better data and ... with the patch the hang reported earlier was not encountered again so ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [CFT][PATCH] 2.6.4-rc1 remove x86 boot page tables
      ... > For VISWS I think you actually need to turn paging off explicitly. ... The patch will need a few tweaks but it should be fairly straight forward. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH] clarify message and give support contact for non-GPL modules
      ... The author of the second module ... So here is another attempt at the patch. ... send the line "unsubscribe linux-kernel" in ... More majordomo info at http://vger.kernel.org/majordomo-info.html ...
      (Linux-Kernel)