Commit d172f4ef authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Modules: fix memory leak of module names

Due to the change in kobject name handling, the module kobject needs to
have a null release function to ensure that the name it previously set
will be properly cleaned up.

All of this wierdness goes away in 2.6.25 with the rework of the kobject
name and cleanup logic, but this is required for 2.6.24.

Thanks to Alexey Dobriyan for finding the problem, and to Kay Sievers
for pointing out the simple way to fix it after I tried many complex
ways.

Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent e5f114e9
...@@ -697,8 +697,18 @@ static struct kset_uevent_ops module_uevent_ops = { ...@@ -697,8 +697,18 @@ static struct kset_uevent_ops module_uevent_ops = {
decl_subsys(module, &module_ktype, &module_uevent_ops); decl_subsys(module, &module_ktype, &module_uevent_ops);
int module_sysfs_initialized; int module_sysfs_initialized;
static void module_release(struct kobject *kobj)
{
/*
* Stupid empty release function to allow the memory for the kobject to
* be properly cleaned up. This will not need to be present for 2.6.25
* with the upcoming kobject core rework.
*/
}
static struct kobj_type module_ktype = { static struct kobj_type module_ktype = {
.sysfs_ops = &module_sysfs_ops, .sysfs_ops = &module_sysfs_ops,
.release = module_release,
}; };
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment