提交 63ce18cf 编写于 作者: M Mike Galbraith 提交者: Greg Kroah-Hartman

driver core: refcounting fix

Fix a reference counting bug exposed by commit
725522b5.  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: NMike Galbraith <efault@gmx.de>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 40cf67c5
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册