HID: roccat: Fix NULL pointer dereference when unloading module
authorStefan Achatz <erazor_de@users.sourceforge.net>
Sun, 30 Jan 2011 12:38:27 +0000 (13:38 +0100)
committerJiri Kosina <jkosina@suse.cz>
Thu, 3 Feb 2011 15:37:28 +0000 (16:37 +0100)
Class was destroyed before starting the unregistering driver chain.
Disconnecting a device from roccat chardev in this process then
raised a NULL pointer dereference.
Fixed this by destroying class after unregistering driver.

Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-roccat-arvo.c
drivers/hid/hid-roccat-kone.c
drivers/hid/hid-roccat-koneplus.c
drivers/hid/hid-roccat-kovaplus.c
drivers/hid/hid-roccat-pyra.c

index 7b9a992611bc5f473c986c3f70c63b908ba14c20..75f532f4d4cc8bd3e842e9668904af8acba709de 100644 (file)
@@ -438,8 +438,8 @@ static int __init arvo_init(void)
 
 static void __exit arvo_exit(void)
 {
-       class_destroy(arvo_class);
        hid_unregister_driver(&arvo_driver);
+       class_destroy(arvo_class);
 }
 
 module_init(arvo_init);
index 5cdb282dad11be5da4f33841424b0be5866e98a9..d7497964a5b32bca475fafc579b8ffb0a482d192 100644 (file)
@@ -844,8 +844,8 @@ static int __init kone_init(void)
 
 static void __exit kone_exit(void)
 {
-       class_destroy(kone_class);
        hid_unregister_driver(&kone_driver);
+       class_destroy(kone_class);
 }
 
 module_init(kone_init);
index 7367e4edfa6c0ebfaaf9bd7b7aac0ec4a3879ef9..ac2010732495ddaf0987468a52590095be1564ba 100644 (file)
@@ -774,8 +774,8 @@ static int __init koneplus_init(void)
 
 static void __exit koneplus_exit(void)
 {
-       class_destroy(koneplus_class);
        hid_unregister_driver(&koneplus_driver);
+       class_destroy(koneplus_class);
 }
 
 module_init(koneplus_init);
index 7664e2ce28865a303d7895c6c7ee5689b5505001..4eeb62fb4e75a7cc963fe3e2aa5111f1ad68ca1d 100644 (file)
@@ -703,8 +703,8 @@ static int __init kovaplus_init(void)
 
 static void __exit kovaplus_exit(void)
 {
-       class_destroy(kovaplus_class);
        hid_unregister_driver(&kovaplus_driver);
+       class_destroy(kovaplus_class);
 }
 
 module_init(kovaplus_init);
index be4daa96f7c204e39a8248af367b6e5fbfcd9225..02a72433a712b25e6af4e8166172d6a3dbe9bd2f 100644 (file)
@@ -685,8 +685,8 @@ static int __init pyra_init(void)
 
 static void __exit pyra_exit(void)
 {
-       class_destroy(pyra_class);
        hid_unregister_driver(&pyra_driver);
+       class_destroy(pyra_class);
 }
 
 module_init(pyra_init);