On Fri, Mar 23, 2012 at 01:11:57PM +0100, Johan Hovold wrote: > Hi Alan and Greg, > > There seems to be a problem with the new API for serial driver > registration/deregistration. > > I get the following oops with usb-next when unloading a usb-serial > driver (verified with both ftdi_sio and pl2303) while the device is > connected: > > [ 261.314161] USB Serial deregistering driver pl2303 > [ 261.315285] usbcore: deregistering interface driver pl2303 > [ 261.315721] drivers/usb/serial/usb-serial.c: usb_serial_disconnect > [ 261.317159] ------------[ cut here ]------------ > [ 261.317182] WARNING: at fs/sysfs/inode.c:323 sysfs_hash_and_remove+0x97/0xa0() > [ 261.317208] Hardware name: Vostro 1520 > [ 261.317217] sysfs: can not remove 'ttyUSB0', no directory > [ 261.317225] Modules linked in: pl2303(-) usbserial > [ 261.317255] Pid: 1089, comm: modprobe Not tainted 3.3.0-rc7+ #82 > [ 261.317279] Call Trace: > [ 261.317295] [<c102d862>] warn_slowpath_common+0x72/0xa0 > [ 261.317310] [<c113abb7>] ? sysfs_hash_and_remove+0x97/0xa0 > [ 261.317324] [<c113abb7>] ? sysfs_hash_and_remove+0x97/0xa0 > [ 261.317352] [<c102d933>] warn_slowpath_fmt+0x33/0x40 > [ 261.317365] [<c113abb7>] sysfs_hash_and_remove+0x97/0xa0 > [ 261.317381] [<c113d350>] sysfs_remove_link+0x20/0x30 > [ 261.317399] [<c12edd50>] driver_sysfs_remove+0x20/0x30 > [ 261.317426] [<c12edd8b>] __device_release_driver+0x2b/0xb0 > [ 261.317441] [<c12eded7>] device_release_driver+0x27/0x40 > [ 261.317454] [<c12ed4b4>] bus_remove_device+0xd4/0x130 > [ 261.317468] [<c12eb871>] ? device_remove_attrs+0x21/0x90 > [ 261.317495] [<c12eb9c5>] device_del+0xe5/0x170 > [ 261.317514] [<f806f74e>] usb_serial_disconnect+0xce/0x150 [usbserial] > [ 261.317532] [<c1338186>] usb_unbind_interface+0x46/0x160 > [ 261.317547] [<c12eddc4>] __device_release_driver+0x64/0xb0 > [ 261.317574] [<c12edea7>] driver_detach+0x97/0xa0 > [ 261.317587] [<c12ecfdc>] bus_remove_driver+0x6c/0xe0 > [ 261.317602] [<c12ee9b9>] driver_unregister+0x49/0x80 > [ 261.317618] [<c105adbb>] ? sub_preempt_count+0x7b/0xb0 > [ 261.317645] [<c1337f05>] usb_deregister+0xa5/0xb0 > [ 261.317662] [<f806e8ed>] usb_serial_deregister_drivers+0x2d/0x40 [usbserial] > [ 261.317678] [<f8102a76>] pl2303_driver_exit+0x12/0x14 [pl2303] > [ 261.317692] [<c108038d>] sys_delete_module+0x15d/0x240 > [ 261.317721] [<c1104d5e>] ? mntput+0x1e/0x30 > [ 261.317736] [<c1458543>] ? sysenter_exit+0xf/0x18 > [ 261.317754] [<c107317c>] ? trace_hardirqs_on_caller+0xec/0x170 > [ 261.317781] [<c1458510>] sysenter_do_call+0x12/0x36 > [ 261.317792] ---[ end trace 2d30ba1801cf0bd6 ]--- > [ 261.318374] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0 I forgot the actual oops which comes after the above warning. Here's the full log for ftdi_sio: [ 66.109316] drivers/usb/serial/ftdi_sio.c: ftdi_exit [ 66.109339] USB Serial deregistering driver FTDI USB Serial Device [ 66.110531] usbcore: deregistering interface driver ftdi_sio [ 66.110757] drivers/usb/serial/usb-serial.c: usb_serial_disconnect [ 66.112323] ------------[ cut here ]------------ [ 66.112343] WARNING: at fs/sysfs/inode.c:323 sysfs_hash_and_remove+0x97/0xa0() [ 66.112353] Hardware name: Vostro 1520 [ 66.112362] sysfs: can not remove 'ttyUSB0', no directory [ 66.112371] Modules linked in: ftdi_sio(-) usbserial [ 66.112418] Pid: 1107, comm: modprobe Not tainted 3.3.0-rc7+ #89 [ 66.112428] Call Trace: [ 66.112445] [<c102d862>] warn_slowpath_common+0x72/0xa0 [ 66.112473] [<c113abb7>] ? sysfs_hash_and_remove+0x97/0xa0 [ 66.112487] [<c113abb7>] ? sysfs_hash_and_remove+0x97/0xa0 [ 66.112500] [<c102d933>] warn_slowpath_fmt+0x33/0x40 [ 66.112516] [<c113abb7>] sysfs_hash_and_remove+0x97/0xa0 [ 66.112532] [<c113d350>] sysfs_remove_link+0x20/0x30 [ 66.112564] [<c12edd50>] driver_sysfs_remove+0x20/0x30 [ 66.112578] [<c12edd8b>] __device_release_driver+0x2b/0xb0 [ 66.112592] [<c12eded7>] device_release_driver+0x27/0x40 [ 66.112608] [<c12ed4b4>] bus_remove_device+0xd4/0x130 [ 66.112635] [<c12eb871>] ? device_remove_attrs+0x21/0x90 [ 66.112649] [<c12eb9c5>] device_del+0xe5/0x170 [ 66.112668] [<f806f74e>] usb_serial_disconnect+0xce/0x150 [usbserial] [ 66.112685] [<c1338186>] usb_unbind_interface+0x46/0x160 [ 66.112713] [<c12eddc4>] __device_release_driver+0x64/0xb0 [ 66.112727] [<c12edea7>] driver_detach+0x97/0xa0 [ 66.112742] [<c12ecfdc>] bus_remove_driver+0x6c/0xe0 [ 66.112770] [<c12ee9b9>] driver_unregister+0x49/0x80 [ 66.112785] [<c105adbb>] ? sub_preempt_count+0x7b/0xb0 [ 66.112799] [<c1337f05>] usb_deregister+0xa5/0xb0 [ 66.112828] [<f806e8ed>] usb_serial_deregister_drivers+0x2d/0x40 [usbserial] [ 66.112846] [<f811aa02>] ftdi_exit+0x3a/0x3c [ftdi_sio] [ 66.112861] [<c108038d>] sys_delete_module+0x15d/0x240 [ 66.112890] [<c1104d5e>] ? mntput+0x1e/0x30 [ 66.112906] [<c1458543>] ? sysenter_exit+0xf/0x18 [ 66.112922] [<c107317c>] ? trace_hardirqs_on_caller+0xec/0x170 [ 66.112949] [<c1458510>] sysenter_do_call+0x12/0x36 [ 66.112960] ---[ end trace 6b4f15790c8ba039 ]--- [ 66.113114] drivers/usb/serial/ftdi_sio.c: ftdi_sio_port_remove [ 66.113124] drivers/usb/serial/ftdi_sio.c: remove_sysfs_attrs [ 66.113901] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0 [ 66.113944] BUG: unable to handle kernel NULL pointer dereference at 0000002c [ 66.113965] IP: [<c1440e96>] klist_put+0x16/0x90 [ 66.113986] *pde = 00000000 [ 66.114000] Oops: 0000 [#1] PREEMPT SMP [ 66.114026] Modules linked in: ftdi_sio(-) usbserial [ 66.114052] [ 66.114062] Pid: 1107, comm: modprobe Tainted: G W 3.3.0-rc7+ #89 Dell Inc. Vostro 1520/0T816J [ 66.114090] EIP: 0060:[<c1440e96>] EFLAGS: 00010246 CPU: 1 [ 66.114090] EIP is at klist_put+0x16/0x90 [ 66.114090] EAX: f53fadc0 EBX: 00000000 ECX: 00000000 EDX: 00000001 [ 66.114090] ESI: f53fadc0 EDI: f8073b20 EBP: f51d9dc4 ESP: f51d9db4 [ 66.114090] DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068 [ 66.114090] Process modprobe (pid: 1107, ti=f51d8000 task=f6102300 task.ti=f51d8000) [ 66.114090] Stack: [ 66.114090] f51d9dc0 f6102300 f53fadc0 f8073b20 f51d9dcc c1440f3d f51d9df4 c1440f8c [ 66.114090] c166a480 c166a480 f53fadc0 f6102300 00000000 c12f0d19 f508524c f811ea94 [ 66.114090] f51d9e04 c12edde0 f5085280 f508524c f51d9e14 c12eded7 f5153a4c f508524c [ 66.114090] Call Trace: [ 66.114090] [<c1440f3d>] klist_del+0xd/0x10 [ 66.114090] [<c1440f8c>] klist_remove+0x4c/0x90 [ 66.114090] [<c12f0d19>] ? devres_release_all+0x39/0x60 [ 66.114090] [<c12edde0>] __device_release_driver+0x80/0xb0 [ 66.114090] [<c12eded7>] device_release_driver+0x27/0x40 [ 66.114090] [<c12ed4b4>] bus_remove_device+0xd4/0x130 [ 66.114090] [<c12eb871>] ? device_remove_attrs+0x21/0x90 [ 66.114090] [<c12eb9c5>] device_del+0xe5/0x170 [ 66.114090] [<f806f74e>] usb_serial_disconnect+0xce/0x150 [usbserial] [ 66.114090] [<c1338186>] usb_unbind_interface+0x46/0x160 [ 66.114090] [<c12eddc4>] __device_release_driver+0x64/0xb0 [ 66.114090] [<c12edea7>] driver_detach+0x97/0xa0 [ 66.114090] [<c12ecfdc>] bus_remove_driver+0x6c/0xe0 [ 66.114090] [<c12ee9b9>] driver_unregister+0x49/0x80 [ 66.114090] [<c105adbb>] ? sub_preempt_count+0x7b/0xb0 [ 66.114090] [<c1337f05>] usb_deregister+0xa5/0xb0 [ 66.114090] [<f806e8ed>] usb_serial_deregister_drivers+0x2d/0x40 [usbserial] [ 66.114090] [<f811aa02>] ftdi_exit+0x3a/0x3c [ftdi_sio] [ 66.114090] [<c108038d>] sys_delete_module+0x15d/0x240 [ 66.114090] [<c1104d5e>] ? mntput+0x1e/0x30 [ 66.114090] [<c1458543>] ? sysenter_exit+0xf/0x18 [ 66.114090] [<c107317c>] ? trace_hardirqs_on_caller+0xec/0x170 [ 66.114090] [<c1458510>] sysenter_do_call+0x12/0x36 [ 66.114090] Code: d0 2a 58 c1 e8 1c ca be ff 8b 4d e8 eb 85 8d b4 26 00 00 00 00 55 89 e5 83 ec 10 89 75 f8 89 5d f4 89 7d fc 89 c6 8b 18 83 e3 fe <8b> 7b 2c 89 d8 88 55 f0 e8 0d 63 01 00 0f b6 55 f0 84 d2 74 0b [ 66.114090] EIP: [<c1440e96>] klist_put+0x16/0x90 SS:ESP 0068:f51d9db4 [ 66.114090] CR2: 000000000000002c [ 66.115395] ---[ end trace 6b4f15790c8ba03a ]--- > The problem appears to be related to the reversed order of > deregistration (usb-serial driver is now deregistered before usb > driver). > > I've verified my suspicion in so far as commit 97b6b6d2339f67 > ("usb-serial: use new registration API in [d-h]* drivers") in usb-next > is indeed the commit introducing the regression for ftdi_sio. Thanks, Johan -- 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