summaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel
diff options
context:
space:
mode:
authorChristian Borntraeger <borntraeger@de.ibm.com>2009-10-06 10:33:58 +0200
committerMartin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com>2009-10-06 10:35:06 +0200
commit6a03f5f0a0a660895eac03749165c1f9313ef2b8 (patch)
tree24fbcac88baf4c487965ec3edceb9621985dcf56 /arch/s390/kernel
parent[S390] Enable kmemleak on s390. (diff)
downloadlinux-6a03f5f0a0a660895eac03749165c1f9313ef2b8.tar.xz
linux-6a03f5f0a0a660895eac03749165c1f9313ef2b8.zip
[S390] module: fix memory leak in s390 module loader
The s390 version of module_frob_arch_sections allocates additional syminfos for got and plt offsets. These syminfos are freed on sucessful module load. If the module fails to load (e.g. missing dependency when using insmod instead of modprobe) this area is not freed. This patch lets module_free free this area. Please note, we have to set the pointer to NULL since module_free is called several times from the generic code. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel')
-rw-r--r--arch/s390/kernel/module.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c
index ab2e3ed28abc..639380a0c45c 100644
--- a/arch/s390/kernel/module.c
+++ b/arch/s390/kernel/module.c
@@ -55,6 +55,8 @@ void *module_alloc(unsigned long size)
/* Free memory returned from module_alloc */
void module_free(struct module *mod, void *module_region)
{
+ vfree(mod->arch.syminfo);
+ mod->arch.syminfo = NULL;
vfree(module_region);
}
@@ -402,6 +404,7 @@ int module_finalize(const Elf_Ehdr *hdr,
struct module *me)
{
vfree(me->arch.syminfo);
+ me->arch.syminfo = NULL;
return module_bug_finalize(hdr, sechdrs, me);
}