aboutsummaryrefslogtreecommitdiffstats
path: root/fs/binfmt_elf.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/binfmt_elf.c')
-rw-r--r--fs/binfmt_elf.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index b25707fee2cc..d48ff5f370f4 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -16,7 +16,6 @@
16#include <linux/time.h> 16#include <linux/time.h>
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/mman.h> 18#include <linux/mman.h>
19#include <linux/a.out.h>
20#include <linux/errno.h> 19#include <linux/errno.h>
21#include <linux/signal.h> 20#include <linux/signal.h>
22#include <linux/binfmts.h> 21#include <linux/binfmts.h>
@@ -256,7 +255,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
256 return -EFAULT; 255 return -EFAULT;
257 len = strnlen_user((void __user *)p, MAX_ARG_STRLEN); 256 len = strnlen_user((void __user *)p, MAX_ARG_STRLEN);
258 if (!len || len > MAX_ARG_STRLEN) 257 if (!len || len > MAX_ARG_STRLEN)
259 return 0; 258 return -EINVAL;
260 p += len; 259 p += len;
261 } 260 }
262 if (__put_user(0, argv)) 261 if (__put_user(0, argv))
@@ -268,7 +267,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
268 return -EFAULT; 267 return -EFAULT;
269 len = strnlen_user((void __user *)p, MAX_ARG_STRLEN); 268 len = strnlen_user((void __user *)p, MAX_ARG_STRLEN);
270 if (!len || len > MAX_ARG_STRLEN) 269 if (!len || len > MAX_ARG_STRLEN)
271 return 0; 270 return -EINVAL;
272 p += len; 271 p += len;
273 } 272 }
274 if (__put_user(0, envp)) 273 if (__put_user(0, envp))
@@ -548,7 +547,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
548 struct { 547 struct {
549 struct elfhdr elf_ex; 548 struct elfhdr elf_ex;
550 struct elfhdr interp_elf_ex; 549 struct elfhdr interp_elf_ex;
551 struct exec interp_ex;
552 } *loc; 550 } *loc;
553 551
554 loc = kmalloc(sizeof(*loc), GFP_KERNEL); 552 loc = kmalloc(sizeof(*loc), GFP_KERNEL);
@@ -680,7 +678,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
680 } 678 }
681 679
682 /* Get the exec headers */ 680 /* Get the exec headers */
683 loc->interp_ex = *((struct exec *)bprm->buf);
684 loc->interp_elf_ex = *((struct elfhdr *)bprm->buf); 681 loc->interp_elf_ex = *((struct elfhdr *)bprm->buf);
685 break; 682 break;
686 } 683 }
@@ -1900,7 +1897,7 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file, un
1900 /* alloc memory for large data structures: too large to be on stack */ 1897 /* alloc memory for large data structures: too large to be on stack */
1901 elf = kmalloc(sizeof(*elf), GFP_KERNEL); 1898 elf = kmalloc(sizeof(*elf), GFP_KERNEL);
1902 if (!elf) 1899 if (!elf)
1903 goto cleanup; 1900 goto out;
1904 1901
1905 segs = current->mm->map_count; 1902 segs = current->mm->map_count;
1906#ifdef ELF_CORE_EXTRA_PHDRS 1903#ifdef ELF_CORE_EXTRA_PHDRS
@@ -2034,8 +2031,9 @@ end_coredump:
2034 set_fs(fs); 2031 set_fs(fs);
2035 2032
2036cleanup: 2033cleanup:
2037 kfree(elf);
2038 free_note_info(&info); 2034 free_note_info(&info);
2035 kfree(elf);
2036out:
2039 return has_dumped; 2037 return has_dumped;
2040} 2038}
2041 2039