diff options
Diffstat (limited to 'fs/binfmt_elf.c')
-rw-r--r-- | fs/binfmt_elf.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 33b7235f853b..40381df34869 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -12,8 +12,6 @@ | |||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/fs.h> | 14 | #include <linux/fs.h> |
15 | #include <linux/stat.h> | ||
16 | #include <linux/time.h> | ||
17 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
18 | #include <linux/mman.h> | 16 | #include <linux/mman.h> |
19 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
@@ -21,20 +19,15 @@ | |||
21 | #include <linux/binfmts.h> | 19 | #include <linux/binfmts.h> |
22 | #include <linux/string.h> | 20 | #include <linux/string.h> |
23 | #include <linux/file.h> | 21 | #include <linux/file.h> |
24 | #include <linux/fcntl.h> | ||
25 | #include <linux/ptrace.h> | ||
26 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
27 | #include <linux/shm.h> | ||
28 | #include <linux/personality.h> | 23 | #include <linux/personality.h> |
29 | #include <linux/elfcore.h> | 24 | #include <linux/elfcore.h> |
30 | #include <linux/init.h> | 25 | #include <linux/init.h> |
31 | #include <linux/highuid.h> | 26 | #include <linux/highuid.h> |
32 | #include <linux/smp.h> | ||
33 | #include <linux/compiler.h> | 27 | #include <linux/compiler.h> |
34 | #include <linux/highmem.h> | 28 | #include <linux/highmem.h> |
35 | #include <linux/pagemap.h> | 29 | #include <linux/pagemap.h> |
36 | #include <linux/security.h> | 30 | #include <linux/security.h> |
37 | #include <linux/syscalls.h> | ||
38 | #include <linux/random.h> | 31 | #include <linux/random.h> |
39 | #include <linux/elf.h> | 32 | #include <linux/elf.h> |
40 | #include <linux/utsname.h> | 33 | #include <linux/utsname.h> |
@@ -576,7 +569,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
576 | unsigned long error; | 569 | unsigned long error; |
577 | struct elf_phdr *elf_ppnt, *elf_phdata; | 570 | struct elf_phdr *elf_ppnt, *elf_phdata; |
578 | unsigned long elf_bss, elf_brk; | 571 | unsigned long elf_bss, elf_brk; |
579 | int elf_exec_fileno; | ||
580 | int retval, i; | 572 | int retval, i; |
581 | unsigned int size; | 573 | unsigned int size; |
582 | unsigned long elf_entry; | 574 | unsigned long elf_entry; |
@@ -631,12 +623,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
631 | goto out_free_ph; | 623 | goto out_free_ph; |
632 | } | 624 | } |
633 | 625 | ||
634 | retval = get_unused_fd(); | ||
635 | if (retval < 0) | ||
636 | goto out_free_ph; | ||
637 | get_file(bprm->file); | ||
638 | fd_install(elf_exec_fileno = retval, bprm->file); | ||
639 | |||
640 | elf_ppnt = elf_phdata; | 626 | elf_ppnt = elf_phdata; |
641 | elf_bss = 0; | 627 | elf_bss = 0; |
642 | elf_brk = 0; | 628 | elf_brk = 0; |
@@ -655,13 +641,13 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
655 | retval = -ENOEXEC; | 641 | retval = -ENOEXEC; |
656 | if (elf_ppnt->p_filesz > PATH_MAX || | 642 | if (elf_ppnt->p_filesz > PATH_MAX || |
657 | elf_ppnt->p_filesz < 2) | 643 | elf_ppnt->p_filesz < 2) |
658 | goto out_free_file; | 644 | goto out_free_ph; |
659 | 645 | ||
660 | retval = -ENOMEM; | 646 | retval = -ENOMEM; |
661 | elf_interpreter = kmalloc(elf_ppnt->p_filesz, | 647 | elf_interpreter = kmalloc(elf_ppnt->p_filesz, |
662 | GFP_KERNEL); | 648 | GFP_KERNEL); |
663 | if (!elf_interpreter) | 649 | if (!elf_interpreter) |
664 | goto out_free_file; | 650 | goto out_free_ph; |
665 | 651 | ||
666 | retval = kernel_read(bprm->file, elf_ppnt->p_offset, | 652 | retval = kernel_read(bprm->file, elf_ppnt->p_offset, |
667 | elf_interpreter, | 653 | elf_interpreter, |
@@ -956,8 +942,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
956 | 942 | ||
957 | kfree(elf_phdata); | 943 | kfree(elf_phdata); |
958 | 944 | ||
959 | sys_close(elf_exec_fileno); | ||
960 | |||
961 | set_binfmt(&elf_format); | 945 | set_binfmt(&elf_format); |
962 | 946 | ||
963 | #ifdef ARCH_HAS_SETUP_ADDITIONAL_PAGES | 947 | #ifdef ARCH_HAS_SETUP_ADDITIONAL_PAGES |
@@ -1028,8 +1012,6 @@ out_free_dentry: | |||
1028 | fput(interpreter); | 1012 | fput(interpreter); |
1029 | out_free_interp: | 1013 | out_free_interp: |
1030 | kfree(elf_interpreter); | 1014 | kfree(elf_interpreter); |
1031 | out_free_file: | ||
1032 | sys_close(elf_exec_fileno); | ||
1033 | out_free_ph: | 1015 | out_free_ph: |
1034 | kfree(elf_phdata); | 1016 | kfree(elf_phdata); |
1035 | goto out; | 1017 | goto out; |