summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorMike Galbraith <efault@gmx.de>2007-02-21 20:45:35 (GMT)
committerGreg Kroah-Hartman <gregkh@suse.de>2007-02-23 22:52:09 (GMT)
commit63ce18cfe685115ff8d341bae4c9204a79043cf0 (patch)
tree7f37a6f9f0453b2122e490d6ef68f213d8a878a3 /kernel
parent40cf67c5fcc513406558c01b91129280208e57bf (diff)
downloadlinux-fsl-qoriq-63ce18cfe685115ff8d341bae4c9204a79043cf0.tar.xz
driver core: refcounting fix
Fix a reference counting bug exposed by commit 725522b5453dd680412f2b6463a988e4fd148757. 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>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/module.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 8c25b1a..1ecf081 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -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