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

From: Tomas Qgren?= (stric_at_acc.umu.se)
Date: 04/08/05

  • Next message: Kylene Jo Hall: "Re: [PATCH] Add TPM hardware enablement driver"
    Date:	Fri, 8 Apr 2005 21:56:33 +0200
    To: linux-kernel@vger.kernel.org
    
    

    Hello.

    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.

    I have tested this on Dell Optiplex GX150, 260 and 280's which has Intel
    P3 and P4 with Intel UHCI USB chipset. I have tested both usb-uhci.o and
    uhci.o with the same results. Tested with USB Bluetooth dongles with
    both Broadcom and Cambridge Silicon Radio chipsets, same results.

    modules loaded: l2cap, hci_usb, bluez, (usb-)uhci, usbcore

    diff -ruN linux-2.4.27-pre1/drivers/bluetooth/hci_usb.c linux-2.4.27-pre2/drivers/bluetooth/hci_usb.c
    --- linux-2.4.27-pre1/drivers/bluetooth/hci_usb.c 2004-04-14 15:05:29.000000000 +0200
    +++ linux-2.4.27-pre2/drivers/bluetooth/hci_usb.c 2005-04-08 20:16:51.000000000 +0200
    @@ -699,11 +699,11 @@
            BT_DBG("%s urb %p type %d status %d count %d flags %x", hdev->name, urb,
                            _urb->type, urb->status, count, urb->transfer_flags);

    - if (!test_bit(HCI_RUNNING, &hdev->flags))
    - return;
    -
            read_lock(&husb->completion_lock);

    + if (!test_bit(HCI_RUNNING, &hdev->flags))
    + goto unlock;
    +
            if (urb->status || !count)
                    goto resubmit;

    @@ -740,6 +740,8 @@
                    BT_DBG("%s urb %p type %d resubmit status %d", hdev->name, urb,
                                    _urb->type, err);
            }
    +
    +unlock:
            read_unlock(&husb->completion_lock);
     }

    Please CC me for any responses, not on the list.

    /Tomas

    -- 
    Tomas Ögren, stric@acc.umu.se, http://www.acc.umu.se/~stric/
    |- Student at Computing Science, University of Umeå
    `- Sysadmin at {cs,acc}.umu.se
    -
    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: Kylene Jo Hall: "Re: [PATCH] Add TPM hardware enablement driver"

    Relevant Pages

    • Re: bluetooth dongle to dongle
      ... Im looking at bluetooth to cominucate with a remote mcu from my pc, ... so the obvious question is what do I need to use the 2nd dongle on my remote ... looks like a pc usb port, ...
      (sci.electronics.design)
    • Re: How to support bluetooth radio (USB interface) in WinCE 5.0
      ... Which Bluetooth driver are you using? ... looks, from that, like you're not getting the dongle turned on. ... USB 2.0 port on your main board? ...
      (microsoft.public.windowsce.platbuilder)
    • Re: Problems with usb bluetooth device
      ... yesterday I bought a shiny new hama usb bluetooth dongle but I am having ...
      (freebsd-current)
    • Re: USB: Can I Add another device by soldering it inside?
      ... >computer by soldering it to the inside of the USB connector. ... When used as a dongle, Bluetooth is constant source of the ... >my notebook and connect the dongle to that cable and just place such ...
      (sci.electronics.basics)
    • Embedded Bluetooth module VS USB dongle
      ... The basic configuration I've sketched out on the back of the proverbial envelope is a PIC 18F4550 with an FTDI Vinculum chip hosting a USB Bluetooth device because the Bluetooth USB dongles are considerably cheaper than OEM Bluetooth dongles although all of the dongles I've pulled apart have had a module fitted to a base board. ... My question is, would it be *much* easier to use a BT module than the dongle, I may want to be able to attach more storage in the future so I can log data outside the range of Blue tooth so the FTDI chip looks nice from the point of being able to attach a simple USB flash device as well although I could just attach an SD/MMC card to the PIC. ...
      (comp.arch.embedded)