[PATCH 1/2] usb-serial : fix the nousb oops

From: Dave Young
Date: Sun Feb 01 2009 - 05:53:51 EST



In case with "nousb" booting, serial drivers will trigger kernel oops.

Here add usb_disabled() check in usb_serial_init and usb_serial_register

Signed-off-by: Dave Young <hidave.darkstar@xxxxxxxxx>
---
drivers/usb/serial/usb-serial.c | 6 ++++++
1 file changed, 6 insertions(+)

diff -uprN a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
--- a/drivers/usb/serial/usb-serial.c 2009-02-01 13:11:11.000000000 +0800
+++ b/drivers/usb/serial/usb-serial.c 2009-02-01 13:24:32.000000000 +0800
@@ -1113,6 +1113,9 @@ static int __init usb_serial_init(void)
int i;
int result;

+ if (usb_disabled())
+ return -ENODEV;
+
usb_serial_tty_driver = alloc_tty_driver(SERIAL_TTY_MINORS);
if (!usb_serial_tty_driver)
return -ENOMEM;
@@ -1230,6 +1233,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)
--
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/