aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorWANG Cong <xiyou.wangcong@gmail.com>2008-05-06 12:45:35 +0800
committerAl Viro <viro@zeniv.linux.org.uk>2008-05-16 17:22:58 -0400
commit5f719558edf9c84bfbb1f7ad37e84c483282d09f (patch)
treeacbd9ec7343ad6d7933015c40b0acf378a2d2418 /fs
parent[PATCH] avoid multiplication overflows and signedness issues for max_fds (diff)
downloadlinux-dev-5f719558edf9c84bfbb1f7ad37e84c483282d09f.tar.xz
linux-dev-5f719558edf9c84bfbb1f7ad37e84c483282d09f.zip
[Patch] fs/binfmt_elf.c: fix a wrong free
In kmalloc failing path, we shouldn't free pointers in 'info', because the struct 'info' is uninitilized when kmalloc is called. And when kmalloc returns NULL, it's needless to kfree it. Signed-off-by: WANG Cong <wangcong@zeuux.org> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi> -- Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/binfmt_elf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index b25707fee2cc..bd08332079cf 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1900,7 +1900,7 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file, un
/* alloc memory for large data structures: too large to be on stack */
elf = kmalloc(sizeof(*elf), GFP_KERNEL);
if (!elf)
- goto cleanup;
+ goto out;
segs = current->mm->map_count;
#ifdef ELF_CORE_EXTRA_PHDRS
@@ -2034,8 +2034,9 @@ end_coredump:
set_fs(fs);
cleanup:
- kfree(elf);
free_note_info(&info);
+ kfree(elf);
+out:
return has_dumped;
}