[PATCH 1/11] Driver core: fix bug in class-device code
Alan Stern <[email protected]>
| Newsgroups | gmane.linux.usb.devel |
|---|---|
| Message-ID | <[email protected]> |
This patch (as878) fixes a straightforward use-after-free bug in the class-device core. Just because the object in question is deprecated is no excuse for causing an oops. Signed-off-by: Alan Stern <[email protected]> --- This isn't related very closely to the USB stuff. My main reason for putting it here was that the bug made testing the other patches very difficult! Index: usb-2.6/drivers/base/class.c =================================================================== --- usb-2.6.orig/drivers/base/class.c +++ usb-2.6/drivers/base/class.c @@ -199,6 +199,11 @@ void class_unregister(struct class * cls { pr_debug("device class '%s': unregistering\n", cls->name); +#ifdef CONFIG_SYSFS_DEPRECATED_FUTURE + kobject_del(&cls->class_dir_depr); + kobject_put(&cls->class_dir_depr); +#endif + if (cls->bus) put_bus(cls->bus); else { @@ -206,11 +211,6 @@ void class_unregister(struct class * cls kset_unregister(&cls->devices_dir); subsystem_unregister(&cls->subsys); } - -#ifdef CONFIG_SYSFS_DEPRECATED_FUTURE - kobject_del(&cls->class_dir_depr); - kobject_put(&cls->class_dir_depr); -#endif } static void class_create_release(struct class *cls) ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ [email protected] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel