Skip to contentSkip to conversation

HID: roccat: Fixed NULL pointer dereference when unloading module

PATCH Applied Stefan Achatz 1 participant 1 message Jan 30, 2011

Subsystems (2)
lore
Share & tools
lore

Stefan Achatz

author maintainer
#0 lore raw

PATCH 7/8 HID: roccat: Fixed NULL pointer dereference when unloading module

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.

---
 drivers/hid/hid-roccat-arvo.c     |    2 +-
 drivers/hid/hid-roccat-kone.c     |    2 +-
 drivers/hid/hid-roccat-koneplus.c |    2 +-
 drivers/hid/hid-roccat-kovaplus.c |    2 +-
 drivers/hid/hid-roccat-pyra.c     |    2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
drivers/hid/hid-roccat-arvo.c +1 -1
index 7b9a992..75f532f 100644
@@ -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);
drivers/hid/hid-roccat-kone.c +1 -1
index 5cdb282..d749796 100644
@@ -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);
drivers/hid/hid-roccat-koneplus.c +1 -1
index 7367e4e..ac20107 100644
@@ -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);
drivers/hid/hid-roccat-kovaplus.c +1 -1
index 7664e2c..4eeb62f 100644
@@ -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);
drivers/hid/hid-roccat-pyra.c +1 -1
index be4daa9..02a7243 100644
@@ -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);
Signature · 1 line
1.7.3.4