usb-serial : fix the nousb oops
Subsystems (2)
PATCH 1/2 usb-serial : fix the nousb oops
In case with "nousb" booting, serial drivers will trigger kernel oops.
Here add usb_disabled() check in usb_serial_init and usb_serial_register
---drivers/usb/serial/usb-serial.c | 6 ++++++
1 file changed, 6 insertions(+)
drivers/usb/serial/usb-serial.c +6 -0
@@ -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)
Quoted 2 lines · Dave Young
In case with "nousb" booting, serial drivers will trigger kernel oops.
They will? What is the oops message?
Quoted 1 line
Here add
usb_disabled()check inusb_serial_initandusb_serial_register
This is odd, is it something new? Why is usb-serial the only driver that needs such a thing?
confused,
greg k-h
Quoted 5 lines · Greg KH
Quoted 2 lines · Dave Young
In case with "nousb" booting, serial drivers will trigger kernel oops.
They will? What is the oops message?
Yes, they will, at lease I saw usb_serial/aircable/ftdi_sio oops. I will manage to copy the oops message later.
Quoted 5 lines
Quoted 2 lines
Here add
usb_disabled()check inusb_serial_initandusb_serial_registerThis is odd, is it something new? Why is usb-serial the only driver that needs such a thing?
No, it is not new thing. usb serial drivers normally call usb_serial_register first, then usb_register, usb_register will fail due to "nousb" checking, but usb_serial_register no.
Quoted 5 lines
confused,
greg k-h
Signature · 2 lines
Regards dave
Quoted 9 lines · Dave Young
Quoted 5 lines · Greg KH
Quoted 2 lines · Dave Young
In case with "nousb" booting, serial drivers will trigger kernel oops.
They will? What is the oops message?
Yes, they will, at lease I saw usb_serial/aircable/ftdi_sio oops. I will manage to copy the oops message later.
I can not copy the oops message, so I just hand copy something here:
BUG: unable to handle kernel NULL pointer dereference at 00000001 IP: [<c0527636>] kset_find_obj+0x3b/0x5c *pde = 00000000 Oops: 0000 [#1] SMP
[snip...]
EIP is at kset_find_obj+0x3b/0x5c
EAX:00000001
[snip...]
Call Trace:
driver_registerdestruct_tty_driverusb_serial_bus_registerusb_serial_registeraircable_init_stextaircable_initrestore_nocheck_notracepci_arch_init
[snip...]
Actually, after the usb_serial_init failed, the usb_serial_bus_type will be unregistered.
So when serial dirvers call usb_serial_register (then usb_serial_bus_register, and then driver_register), due to the bus kset already unregistered kernel will oops.
Quoted 23 lines
Quoted 6 lines
Quoted 3 lines
Here add
usb_disabled()check inusb_serial_initandusb_serial_registerThis is odd, is it something new? Why is usb-serial the only driver that needs such a thing?
No, it is not new thing. usb serial drivers normally call
usb_serial_registerfirst, thenusb_register,usb_registerwill fail due to "nousb" checking, butusb_serial_registerno.Quoted 5 lines
confused,
greg k-h
--
Regards
dave
Signature · 2 lines
Regards dave
Quoted 11 lines · Dave Young
Quoted 5 lines · Greg KH
Quoted 2 lines · Dave Young
In case with "nousb" booting, serial drivers will trigger kernel oops.
They will? What is the oops message?
Yes, they will, at lease I saw usb_serial/aircable/ftdi_sio oops. I will manage to copy the oops message later.
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Here add
usb_disabled()check inusb_serial_initandusb_serial_registerThis is odd, is it something new? Why is usb-serial the only driver that needs such a thing?
No, it is not new thing. usb serial drivers normally call
usb_serial_registerfirst, thenusb_register,usb_registerwill fail due to "nousb" checking, butusb_serial_registerno.
But as usb_register will fail, shouldn't they properly back out and no oopses happen? This sounds like a simple fix to the drivers that are failing here, not changing the usb-serial core.
And this should only be an issue if you build your drivers into the kernel, right?
thanks,
greg k-h
remove [email protected] in cc-list because this mail will be rejected by the smva.com email server.
Quoted 17 lines · Greg KH
Quoted 16 lines · Dave Young
Quoted 5 lines · Greg KH
Quoted 2 lines · Dave Young
In case with "nousb" booting, serial drivers will trigger kernel oops.
They will? What is the oops message?
Yes, they will, at lease I saw usb_serial/aircable/ftdi_sio oops. I will manage to copy the oops message later.
Quoted 5 lines
Quoted 2 lines
Here add
usb_disabled()check inusb_serial_initandusb_serial_registerThis is odd, is it something new? Why is usb-serial the only driver that needs such a thing?
Quoted 7 lines
Quoted 3 lines
No, it is not new thing. usb serial drivers normally call
usb_serial_registerfirst, thenusb_register,usb_registerwill fail due to "nousb" checking, butusb_serial_registerno.But as
usb_registerwill fail, shouldn't they properly back out and no oopses happen? This sounds like a simple fix to the drivers that are failing here, not changing the usb-serial core.
Hi greg
I think all usb serial drivers which call usb_serial_register will oops, so IMHO usb core should be fixed.
I think maybe you missed my another reply, copy the content here again.
---
hand copy part of the oops message:
BUG: unable to handle kernel NULL pointer dereference at 00000001 IP: [<c0527636>] kset_find_obj+0x3b/0x5c *pde = 00000000 Oops: 0000 [#1] SMP
[snip...]
EIP is at kset_find_obj+0x3b/0x5c
EAX:00000001
[snip...]
Call Trace:
driver_registerdestruct_tty_driverusb_serial_bus_registerusb_serial_registeraircable_init_stextaircable_initrestore_nocheck_notracepci_arch_init
[snip...]
Actually, after the usb_serial_init failed, the usb_serial_bus_type will be unregistered.
So when serial dirvers call usb_serial_register (then usb_serial_bus_register, and then driver_register), due to the bus kset already unregistered kernel will oops.
---
Quoted 3 lines
And this should only be an issue if you build your drivers into the kernel, right?
Yes.
Quoted 5 lines
thanks,
greg k-h
Signature · 2 lines
Regards dave
Am Wednesday 04 February 2009 00:58:14 schrieb Greg KH:
Quoted 9 lines · Dave Young
Quoted 4 lines
No, it is not new thing. usb serial drivers normally call
usb_serial_registerfirst, thenusb_register,usb_registerwill fail due to "nousb" checking, butusb_serial_registerno.But as
usb_registerwill fail, shouldn't they properly back out and no oopses happen? This sounds like a simple fix to the drivers that are failing here, not changing the usb-serial core.
usb_register() can also fail for other reasons. There's no way you can save drivers from needing to cleanly fail in that case.
Quoted 2 lines
And this should only be an issue if you build your drivers into the kernel, right?
No, you can load drivers by other methods than udev.
Regards
Oliver
Quoted 29 lines · Dave Young
remove [email protected] in cc-list because this mail will be rejected by the smva.com email server.
Quoted 17 lines · Greg KH
Quoted 16 lines · Dave Young
Quoted 5 lines · Greg KH
Quoted 2 lines · Dave Young
In case with "nousb" booting, serial drivers will trigger kernel oops.
They will? What is the oops message?
Yes, they will, at lease I saw usb_serial/aircable/ftdi_sio oops. I will manage to copy the oops message later.
Quoted 5 lines
Quoted 2 lines
Here add
usb_disabled()check inusb_serial_initandusb_serial_registerThis is odd, is it something new? Why is usb-serial the only driver that needs such a thing?
Quoted 7 lines
Quoted 3 lines
No, it is not new thing. usb serial drivers normally call
usb_serial_registerfirst, thenusb_register,usb_registerwill fail due to "nousb" checking, butusb_serial_registerno.But as
usb_registerwill fail, shouldn't they properly back out and no oopses happen? This sounds like a simple fix to the drivers that are failing here, not changing the usb-serial core.
Quoted 6 lines
Hi greg
I think all usb serial drivers which call
usb_serial_registerwill oops, so IMHO usb core should be fixed.I think maybe you missed my another reply, copy the content here again.
No, I got it.
I'm more interested in why usb-serial is oopsing, as it should't be.
Quoted 2 lines
---
hand copy part of the oops message:
Can you take a picture of the oops?
thanks,
greg k-h
Quoted 37 lines · Greg KH
Quoted 29 lines · Dave Young
remove [email protected] in cc-list because this mail will be rejected by the smva.com email server.
Quoted 17 lines · Greg KH
Quoted 16 lines · Dave Young
Quoted 5 lines · Greg KH
Quoted 2 lines · Dave Young
In case with "nousb" booting, serial drivers will trigger kernel oops.
They will? What is the oops message?
Yes, they will, at lease I saw usb_serial/aircable/ftdi_sio oops. I will manage to copy the oops message later.
Quoted 5 lines
Quoted 2 lines
Here add
usb_disabled()check inusb_serial_initandusb_serial_registerThis is odd, is it something new? Why is usb-serial the only driver that needs such a thing?
Quoted 7 lines
Quoted 3 lines
No, it is not new thing. usb serial drivers normally call
usb_serial_registerfirst, thenusb_register,usb_registerwill fail due to "nousb" checking, butusb_serial_registerno.But as
usb_registerwill fail, shouldn't they properly back out and no oopses happen? This sounds like a simple fix to the drivers that are failing here, not changing the usb-serial core.Quoted 6 lines
Hi greg
I think all usb serial drivers which call
usb_serial_registerwill oops, so IMHO usb core should be fixed.I think maybe you missed my another reply, copy the content here again.
Quoted 8 lines
No, I got it.
I'm more interested in why usb-serial is oopsing, as it should't be.
Quoted 2 lines
---
hand copy part of the oops message:Can you take a picture of the oops?
Hi, I have no camera at hand, I will take the picture tomorrow.
Quoted 5 lines
thanks,
greg k-h
Signature · 2 lines
Regards dave
Quoted 37 lines · Greg KH
Quoted 29 lines · Dave Young
remove [email protected] in cc-list because this mail will be rejected by the smva.com email server.
Quoted 17 lines · Greg KH
Quoted 16 lines · Dave Young
Quoted 5 lines · Greg KH
Quoted 2 lines · Dave Young
In case with "nousb" booting, serial drivers will trigger kernel oops.
They will? What is the oops message?
Yes, they will, at lease I saw usb_serial/aircable/ftdi_sio oops. I will manage to copy the oops message later.
Quoted 5 lines
Quoted 2 lines
Here add
usb_disabled()check inusb_serial_initandusb_serial_registerThis is odd, is it something new? Why is usb-serial the only driver that needs such a thing?
Quoted 7 lines
Quoted 3 lines
No, it is not new thing. usb serial drivers normally call
usb_serial_registerfirst, thenusb_register,usb_registerwill fail due to "nousb" checking, butusb_serial_registerno.But as
usb_registerwill fail, shouldn't they properly back out and no oopses happen? This sounds like a simple fix to the drivers that are failing here, not changing the usb-serial core.Quoted 6 lines
Hi greg
I think all usb serial drivers which call
usb_serial_registerwill oops, so IMHO usb core should be fixed.I think maybe you missed my another reply, copy the content here again.
Quoted 8 lines
No, I got it.
I'm more interested in why usb-serial is oopsing, as it should't be.
Quoted 2 lines
---
hand copy part of the oops message:Can you take a picture of the oops?
Hi, greg:
Yestoday I found that with two diffrent config there's diffrent EIP, please see the attachment (configs), you can use the configs to create the panic.
Due to the image files size I only send them to you in another email.
Quoted 5 lines
thanks,
greg k-h
Signature · 2 lines
Regards dave