[PATCH 47/97] usb-serial: fix usb_serial_register bug when boot with nousb param

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Dave Young <hidave.darkstar@xxxxxxxxx>

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.

Signed-off-by: Dave Young <hidave.darkstar@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
 drivers/usb/serial/usb-serial.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 7317289..742a5bc 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -1241,6 +1241,9 @@ int usb_serial_register(struct usb_serial_driver *driver)
 	/* must be called with BKL held */
 	int retval;
 
+	if (usb_disabled())
+		return -ENODEV;
+
 	fixup_generic(driver);
 
 	if (!driver->description)
-- 
1.6.2

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

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux