Bug 963

Summary: 'rmmod hid' causes 'kernel BUG' in devfs core
Product: File System Reporter: Danny Milosavljevic (danny_milo)
Component: devfsAssignee: Adrian Bunk (bunk)
Severity: low CC: eric, greg
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.0-test1 Tree: Mainline
Regression: ---
Attachments: ksymoops traced output of the kernel
My config
dmesg output before I issue /etc/init.d/hotplug stop
dmesg output after I issue /etc/init.d/hotplug stop
the error message as appearing on screen
the ksymoops 'parsed' version... not really...
the kernel config for 2.6.0
/etc/hotplug/usb.rc, gets called with "stop" as argument
lsmod before /etc/init.d/hotplug stop
lsmod after /etc/init.d/hotplug stop

Description Danny Milosavljevic 2003-07-18 16:47:27 UTC
Distribution: Gentoo 1.4 (cvs)
Hardware Environment: Athlon XP, MSI Kt 3 Ultra 2 (VIA VT8366/A/7)
Software Environment: Linux 2.4.21, usb-storage, usb-uhci, ?

I saw a page here saying "2.5 only", but since I cannot test it using a 2.5 kernel (it unfortunately 
messes with my xfs partitions and damages them), please accept this one :)

The issue is: When I terminate the usb hotplug 20030501 I get a 'kernel BUG at base.c:914'...

I'll try to attach a ksymoops thingie ...
Comment 1 Danny Milosavljevic 2003-07-18 16:49:45 UTC
Created attachment 569 [details]
ksymoops traced output of the kernel
Comment 2 Danny Milosavljevic 2003-07-18 16:50:19 UTC
Created attachment 570 [details]
My config

kernel config file
Comment 3 Danny Milosavljevic 2003-07-18 16:54:23 UTC
This bug is reproduceable every time, so I can test stuff easily etc ;)

The only patch I put over the vanilla kernel is the xfs patch, but that doesnt have anything to do with 
usb, does it ?

Since this is a source based distro, I have everything in source, and I can use a debugger too ;)

Comment 4 Greg Kroah-Hartman 2003-07-18 17:06:16 UTC
Believe the "2.5" only comment :)

This looks like a devfs bug, not a hotplug one too.
Comment 5 Danny Milosavljevic 2003-07-19 02:11:30 UTC
ok, *compiling 2.6.0-test1*

lets see :) 

Comment 6 Danny Milosavljevic 2003-07-19 03:04:29 UTC
Stock 2.6.0-test1.

same error.

The usb hid device is a Seiko Inklink.
The usb storage device is a noname memory stick.

ksymoops complain about not being able to find /proc/ksyms and doesnt do much.

Comment 7 Danny Milosavljevic 2003-07-19 03:06:27 UTC
Created attachment 571 [details]
dmesg output before I issue /etc/init.d/hotplug stop
Comment 8 Danny Milosavljevic 2003-07-19 03:06:50 UTC
Created attachment 572 [details]
dmesg output after I issue /etc/init.d/hotplug stop
Comment 9 Danny Milosavljevic 2003-07-19 03:07:16 UTC
Created attachment 573 [details]
the error message as appearing on screen
Comment 10 Danny Milosavljevic 2003-07-19 03:07:53 UTC
Created attachment 574 [details]
the ksymoops 'parsed' version... not really...
Comment 11 Danny Milosavljevic 2003-07-19 03:12:51 UTC
btw, I suspect this to happen in response to the rmmod calls in maybe_stop_usb in /etc/hotplug/usb.rc 

what next ?
Comment 12 Danny Milosavljevic 2003-07-19 03:13:30 UTC
Created attachment 575 [details]
the kernel config for 2.6.0
Comment 13 Danny Milosavljevic 2003-07-19 03:15:42 UTC
Created attachment 576 [details]
/etc/hotplug/usb.rc, gets called with "stop" as argument
Comment 14 Danny Milosavljevic 2003-07-19 03:21:06 UTC
Created attachment 577 [details]
lsmod before /etc/init.d/hotplug stop
Comment 15 Danny Milosavljevic 2003-07-19 03:21:30 UTC
Created attachment 578 [details]
lsmod after /etc/init.d/hotplug stop
Comment 16 Danny Milosavljevic 2003-07-19 03:21:49 UTC
as you can see, the "hid" module has been removed.
Comment 17 Danny Milosavljevic 2003-07-19 03:36:20 UTC
btw: you may be right that the culprit component is not hotplug, feel free to change it to devfs or 
something, if it is sure that that is the cause...
Comment 18 Greg Kroah-Hartman 2003-07-19 07:50:49 UTC
What does 'tree /dev/usb/' look like before you shutdown the usb stuff?
Comment 19 Danny Milosavljevic 2003-07-19 08:26:01 UTC
tree /dev/usb

`-- hid
    `-- hiddev0

Comment 20 Danny Milosavljevic 2003-07-24 12:08:10 UTC
Okay, I reduced this to the following:

This happens in single mode (without any user-space daemons running etc), with 2.6.0-test1, after 
booting, with only 1 usb device plugged, and that is the "Seiko Inklink Handwriting System". 

rmmod hid -> *boom*
modprobe hid -> ok
rmmod hid -> *boom*   
modprobe hid -> ok
rmmod hid -> *boom*
--> note that both the kernel module and the devfs entry for the hid *are* removed just like they should.

What can I do to track this bug down ?
(f.e.  how can I fix ksymoops to actually do something with 2.5/2.6 ? :))
Comment 21 Greg Kroah-Hartman 2003-07-24 12:24:01 UTC
put the oops here that happens when you remove the hid driver.
Comment 22 Danny Milosavljevic 2003-07-24 14:26:34 UTC
drivers/usb/core/usb.c: deregistering driver hid
usb 3-2: hcd_unlink_urb c6f42708 fail -22
usb 3-2: hcd_unlink_urb cb9d0f3c fail -22
drivers/usb/core/file.c: removing 96 minor
devfs_remove: usb/hid/hiddev0 not found, cannot remove
Call Trace:
 [<c01a515c>] devfs_remove+0x9c/0xa0
 [<c0224d26>] snprintf+0x26/0x30
 [<c02b2ad0>] usb_deregister_dev+0x70/0x90
 [<c015a050>] lookup_hash+0x20/0x30
 [<d083de0f>] hiddev_cleanup+0x1f/0x40 [hid]
 [<d083d8a9>] hid_disconnect+0xb9/0xe0 [hid]
 [<c02aa596>] usb_device_remove+0x66/0x70
 [<c0289afe>] device_release_driver+0x5e/0x60
 [<c0289b22>] driver_detach+0x22/0x40
 [<c0289d7b>] bus_remove_driver+0x3b/0x70
 [<c028a194>] driver_unregister+0x14/0x26
 [<c02aa67a>] usb_deregister+0x2a/0x40
 [<d08403e7>] hid_exit+0x17/0x20 [hid]
 [<c012d035>] sys_delete_module+0x125/0x180
 [<c01427ca>] do_munmap+0x12a/0x180
 [<c0142863>] sys_munmap+0x43/0x60
 [<c010913f>] syscall_call+0x7/0xb
Comment 23 Danny Milosavljevic 2003-07-24 14:28:32 UTC
despite the error message, the /dev/usb/hid/hiddev0 is there after the modprobe, until the rmmod, and 
then it is gone. 

So I dunno why that error message appears, anyways :)
Comment 24 Adrian Bunk 2005-07-02 04:48:03 UTC
devfs is no longer available as of 2.6.13-rc1.