mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 06:31:49 +00:00
driver core: refcounting fix
Fix a reference counting bug exposed by commit
725522b545
. If driver.mod_name exists, we
take a reference in module_add_driver(), and never release it. Undo that
reference in module_remove_driver().
Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
40cf67c5fc
commit
63ce18cfe6
@ -2425,6 +2425,12 @@ void module_remove_driver(struct device_driver *drv)
|
||||
kfree(driver_name);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Undo the additional reference we added in module_add_driver()
|
||||
* via kset_find_obj()
|
||||
*/
|
||||
if (drv->mod_name)
|
||||
kobject_put(&drv->kobj);
|
||||
}
|
||||
EXPORT_SYMBOL(module_remove_driver);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user