[PATCH] hci-usb bugfix

From: Sebastian Schmidt
Date: Sun May 09 2004 - 14:54:14 EST


Hi,

this is a little patch against 2.6.6-rc3 which fixes the Oops when
unplugging an USB Bluetooth device.

hci_usb_disconnect() got called recursively which caused
sysfs_hash_and_remove() finally to dereference a NULL pointer.

--- SNIP ---
diff -uNr linux-2.6.6-rc3.old/drivers/bluetooth/hci_usb.c linux-2.6.6-rc3/drivers/bluetooth/hci_usb.c
--- linux-2.6.6-rc3.old/drivers/bluetooth/hci_usb.c 2004-05-09 20:25:00.000000000 +0200
+++ linux-2.6.6-rc3/drivers/bluetooth/hci_usb.c 2004-05-09 20:28:30.000000000 +0200
@@ -986,8 +986,21 @@

hci_usb_close(hdev);

- if (husb->isoc_iface)
+ if (husb->isoc_iface) {
+#if 0
usb_driver_release_interface(&hci_usb_driver, husb->isoc_iface);
+#else
+ /* do the same as usb_driver_release_interface would do,
+ * except calling diconnect().
+ * usb_driver_release_interface() _does_ check if
+ * are in disconnect() or add, but I really dunno
+ * where dev->driver_list or dev->bus_list gets set.
+ * -- yath
+ */
+ husb->isoc_iface->dev.driver = NULL;
+ usb_set_intfdata(husb->isoc_iface, NULL);
+#endif
+ }

if (hci_unregister_dev(hdev) < 0)
BT_ERR("Can't unregister HCI device %s", hdev->name);
--- SNAP ---

Please apply it,

Sebastian

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