Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

HID: roccat: Fix 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.

Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

authored by

Stefan Achatz and committed by
Jiri Kosina
74b643da 8211e460

+5 -5
+1 -1
drivers/hid/hid-roccat-arvo.c
··· 438 438 439 439 static void __exit arvo_exit(void) 440 440 { 441 - class_destroy(arvo_class); 442 441 hid_unregister_driver(&arvo_driver); 442 + class_destroy(arvo_class); 443 443 } 444 444 445 445 module_init(arvo_init);
+1 -1
drivers/hid/hid-roccat-kone.c
··· 844 844 845 845 static void __exit kone_exit(void) 846 846 { 847 - class_destroy(kone_class); 848 847 hid_unregister_driver(&kone_driver); 848 + class_destroy(kone_class); 849 849 } 850 850 851 851 module_init(kone_init);
+1 -1
drivers/hid/hid-roccat-koneplus.c
··· 774 774 775 775 static void __exit koneplus_exit(void) 776 776 { 777 - class_destroy(koneplus_class); 778 777 hid_unregister_driver(&koneplus_driver); 778 + class_destroy(koneplus_class); 779 779 } 780 780 781 781 module_init(koneplus_init);
+1 -1
drivers/hid/hid-roccat-kovaplus.c
··· 703 703 704 704 static void __exit kovaplus_exit(void) 705 705 { 706 - class_destroy(kovaplus_class); 707 706 hid_unregister_driver(&kovaplus_driver); 707 + class_destroy(kovaplus_class); 708 708 } 709 709 710 710 module_init(kovaplus_init);
+1 -1
drivers/hid/hid-roccat-pyra.c
··· 685 685 686 686 static void __exit pyra_exit(void) 687 687 { 688 - class_destroy(pyra_class); 689 688 hid_unregister_driver(&pyra_driver); 689 + class_destroy(pyra_class); 690 690 } 691 691 692 692 module_init(pyra_init);