Commit d172f4ef31bec924c6ebcb242c9d7d290811e1e5

Authored by Greg Kroah-Hartman
1 parent e5f114e97d

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: Greg Kroah-Hartman <gregkh@suse.de>

Showing 1 changed file with 10 additions and 0 deletions Side-by-side Diff

... ... @@ -697,8 +697,18 @@
697 697 decl_subsys(module, &module_ktype, &module_uevent_ops);
698 698 int module_sysfs_initialized;
699 699  
  700 +static void module_release(struct kobject *kobj)
  701 +{
  702 + /*
  703 + * Stupid empty release function to allow the memory for the kobject to
  704 + * be properly cleaned up. This will not need to be present for 2.6.25
  705 + * with the upcoming kobject core rework.
  706 + */
  707 +}
  708 +
700 709 static struct kobj_type module_ktype = {
701 710 .sysfs_ops = &module_sysfs_ops,
  711 + .release = module_release,
702 712 };
703 713  
704 714 /*