Re: 2.6.6-mm2 (oops on keyboard/mouse USB hub unplug)

From: Duncan Sands
Date: Fri May 14 2004 - 02:23:22 EST


> Unplugging my hub still oopses. This one was introduced in -mm1
> (2.6.6-rc2-mm1 was fine), and reverting mm1's bk-usb.patch fixed it.
> This happens every time.

The following patch from Alan Stern should fix it:

===== drivers/usb/core/message.c 1.83 vs edited =====
--- 1.83/drivers/usb/core/message.c     Mon May  3 06:26:40 2004
+++ edited/drivers/usb/core/message.c   Thu May 13 13:37:48 2004
@@ -830,7 +830,14 @@
                        interface = dev->actconfig->interface[i];
                        dev_dbg (&dev->dev, "unregistering interface %s\n",
                                interface->dev.bus_id);
-                       device_unregister (&interface->dev);
+                       device_del (&interface->dev);
+               }
+
+               /* Now that the interfaces are unbound, nobody should
+                * try to access them.
+                */
+               for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) {
+                       put_device (&dev->actconfig->interface[i]->dev);
                        dev->actconfig->interface[i] = NULL;
                }
                dev->actconfig = 0;
===== drivers/usb/core/usb.c 1.264 vs edited =====
--- 1.264/drivers/usb/core/usb.c        Thu Apr 15 08:19:20 2004
+++ edited/drivers/usb/core/usb.c       Thu May 13 13:40:06 2004
@@ -198,6 +198,9 @@
  * This routine helps device drivers avoid such mistakes.
  * However, you should make sure that you do the right thing with any
  * alternate settings available for this interfaces.
+ *
+ * Don't call this function unless you are bound to one of the interfaces
+ * on this device or you own the dev->serialize semaphore!
  */
 struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, unsigned ifnum)
 {
@@ -228,6 +231,9 @@
  * it would be incorrect to assume that the first altsetting entry in
  * the array corresponds to altsetting zero.  This routine helps device
  * drivers avoid such mistakes.
+ *
+ * Don't call this function unless you are bound to the intf interface
+ * or you own the device's ->serialize semaphore!
  */
 struct usb_host_interface *usb_altnum_to_altsetting(struct usb_interface *intf,
                unsigned int altnum)
-
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/