Skip to contentSkip to conversation

usb-serial: fix usb_serial_register bug when boot with nousb param (v2)

PATCH New Dave Young 1 participant 1 message Feb 14, 2009

Subsystems (2)
lore
Share & tools
lore

Dave Young

author
#0 lore raw

PATCH 1/2 usb-serial: fix usb_serial_register bug when boot with nousb param (v2)

With "nousb" cmdline booting, built-in serial drivers (ie. airecable) will trigger kernel oops.

Indeed, if nousb, usb_serial_init will failed, and the usb serial bus type will not be registerd, then usb_serial_register call driver_register which try to register the driver to a not registered bus.

Here add usb_disabled() check in usb_serial_register to fix it.

---
drivers/usb/serial/usb-serial.c | 3 +++

1 file changed, 3 insertions(+)
drivers/usb/serial/usb-serial.c +3 -0
diff -uprN a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
@@ -1230,6 +1230,9 @@ int usb_serial_register(struct usb_seria
 	/* must be called with BKL held */
 	int retval;
 
+	if (usb_disabled())
+		return -ENODEV;
+
 	fixup_generic(driver);
 
 	if (!driver->description)