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
1 changed files with 6 additions and 0 deletions
|
@ -2425,6 +2425,12 @@ void module_remove_driver(struct device_driver *drv)
|
||||||
kfree(driver_name);
|
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);
|
EXPORT_SYMBOL(module_remove_driver);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue