Skip to contentSkip to conversation

Fix hiddev devfs oops

HID Herbert Xu 4 participants 7 messages Oct 5, 2004 – Oct 13, 2004 USB

lore
Share & tools
lore

Herbert Xu

author
#0 lore raw

Hi:

There is a long-standing devfs_unregister oops in hid/hiddev. It's caused by hid calling hiddev_exit before unregistering itself which in turn calls hiddev_disconnect.

hiddev_exit removes the directory which contains the hiddev devices. Therefore it needs to be called after the hiddev devices have been disconnected.

This patch fixes that.

Marcelo, the same fix is needed in 2.4 as well.

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

===== drivers/usb/input/hid-core.c 1.94 vs edited =====

drivers/usb/input/hid-core.c +1 -1
@@ -1859,8 +1859,8 @@
 
 static void __exit hid_exit(void)
 {
-	hiddev_exit();
 	usb_deregister(&hid_driver);
+	hiddev_exit();
 }
 
 module_init(hid_init);

===== drivers/usb/hid-core.c 1.30 vs edited =====

drivers/usb/hid-core.c +1 -1
@@ -1459,8 +1459,8 @@
 
 static void __exit hid_exit(void)
 {
-	hiddev_exit();
 	usb_deregister(&hid_driver);
+	hiddev_exit();
 }
 
 module_init(hid_init);
#1 lore raw
Quoted 10 lines · Herbert Xu

Hi:

There is a long-standing devfs_unregister oops in hid/hiddev. It's caused by hid calling hiddev_exit before unregistering itself which in turn calls hiddev_disconnect.

hiddev_exit removes the directory which contains the hiddev devices. Therefore it needs to be called after the hiddev devices have been disconnected.

Quoted 5 lines

This patch fixes that.

Marcelo, the same fix is needed in 2.4 as well.

Herbert,

Would be nice to have a version which applies to 2.4 also.

author
#2 lore raw
Quoted 10 lines · Marcelo Tosatti
Quoted 9 lines · Herbert Xu

There is a long-standing devfs_unregister oops in hid/hiddev. It's caused by hid calling hiddev_exit before unregistering itself which in turn calls hiddev_disconnect.

hiddev_exit removes the directory which contains the hiddev devices. Therefore it needs to be called after the hiddev devices have been disconnected.

Quoted 7 lines
Quoted 5 lines

This patch fixes that.

Marcelo, the same fix is needed in 2.4 as well.

Would be nice to have a version which applies to 2.4 also.

I did include a 2.4 patch in that email :)

Here it is again.

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

===== drivers/usb/hid-core.c 1.30 vs edited =====

drivers/usb/hid-core.c +1 -1
@@ -1459,8 +1459,8 @@
 
 static void __exit hid_exit(void)
 {
-	hiddev_exit();
 	usb_deregister(&hid_driver);
+	hiddev_exit();
 }
 
 module_init(hid_init);
#3 lore raw
Quoted 5 lines · On Wed, 13 Oct 2004 07:21:54 +1000 Herbert Xu <[email protected]>…
Quoted 3 lines
Quoted 1 line

Marcelo, the same fix is needed in 2.4 as well.

Would be nice to have a version which applies to 2.4 also.

I did include a 2.4 patch in that email :)

Herbert, I'm sorry for the wait. Marcelo asked me to take care of this, but I kept postponing it because I wanted to look closer, and this and that... It looks entirely reasonable and my hid devices continue to work, but I haven't tested hiddev (UPS or something ?).

-- Pete

drivers/usb/hid-core.c +1 -1
diff -urp -X dontdiff linux-2.4.28-pre3/drivers/usb/hid-core.c linux-2.4.28-pre3-usb/drivers/usb/hid-core.c
@@ -1459,8 +1459,8 @@ static int __init hid_init(void)
 
 static void __exit hid_exit(void)
 {
-	hiddev_exit();
 	usb_deregister(&hid_driver);
+	hiddev_exit();
 }
 
 module_init(hid_init);
author
#4 lore raw
Quoted 5 lines · Pete Zaitcev

Herbert, I'm sorry for the wait. Marcelo asked me to take care of this, but I kept postponing it because I wanted to look closer, and this and that... It looks entirely reasonable and my hid devices continue to work, but I haven't tested hiddev (UPS or something ?).

Yes that's exactly the situation I'm in (APC UPS via USB) and it does fix the OOPS for me when hid is unloaded with the UPS connected.

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#5 lore raw
Quoted 9 lines · Herbert Xu
Quoted 5 lines · Pete Zaitcev

Herbert, I'm sorry for the wait. Marcelo asked me to take care of this, but I kept postponing it because I wanted to look closer, and this and that... It looks entirely reasonable and my hid devices continue to work, but I haven't tested hiddev (UPS or something ?).

Yes that's exactly the situation I'm in (APC UPS via USB) and it does fix the OOPS for me when hid is unloaded with the UPS connected.

Another scenario to keep in mind is unplugging a USB device while a process still has its corresponding hiddev node open. I fixed that issue in 2.6 a while ago. I'm not sure if 2.4 is susceptible. It may or may not be orthogonal to the problem your patch addresses.

--Adam

author
#6 lore raw
Quoted 5 lines · Adam Kropelin

Another scenario to keep in mind is unplugging a USB device while a process still has its corresponding hiddev node open. I fixed that issue in 2.6 a while ago. I'm not sure if 2.4 is susceptible. It may or may not be orthogonal to the problem your patch addresses.

It is unrelated to my issue but yet that fix is needed in 2.4 as well.

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt