diff options
| -rw-r--r-- | fs/binfmt_elf.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 33b7235f853..10462efe5a1 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
| @@ -576,7 +576,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
| 576 | unsigned long error; | 576 | unsigned long error; |
| 577 | struct elf_phdr *elf_ppnt, *elf_phdata; | 577 | struct elf_phdr *elf_ppnt, *elf_phdata; |
| 578 | unsigned long elf_bss, elf_brk; | 578 | unsigned long elf_bss, elf_brk; |
| 579 | int elf_exec_fileno; | ||
| 580 | int retval, i; | 579 | int retval, i; |
| 581 | unsigned int size; | 580 | unsigned int size; |
| 582 | unsigned long elf_entry; | 581 | unsigned long elf_entry; |
| @@ -631,12 +630,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
| 631 | goto out_free_ph; | 630 | goto out_free_ph; |
| 632 | } | 631 | } |
| 633 | 632 | ||
| 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; | 633 | elf_ppnt = elf_phdata; |
| 641 | elf_bss = 0; | 634 | elf_bss = 0; |
| 642 | elf_brk = 0; | 635 | elf_brk = 0; |
| @@ -655,13 +648,13 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
| 655 | retval = -ENOEXEC; | 648 | retval = -ENOEXEC; |
| 656 | if (elf_ppnt->p_filesz > PATH_MAX || | 649 | if (elf_ppnt->p_filesz > PATH_MAX || |
| 657 | elf_ppnt->p_filesz < 2) | 650 | elf_ppnt->p_filesz < 2) |
| 658 | goto out_free_file; | 651 | goto out_free_ph; |
| 659 | 652 | ||
| 660 | retval = -ENOMEM; | 653 | retval = -ENOMEM; |
| 661 | elf_interpreter = kmalloc(elf_ppnt->p_filesz, | 654 | elf_interpreter = kmalloc(elf_ppnt->p_filesz, |
| 662 | GFP_KERNEL); | 655 | GFP_KERNEL); |
| 663 | if (!elf_interpreter) | 656 | if (!elf_interpreter) |
| 664 | goto out_free_file; | 657 | goto out_free_ph; |
| 665 | 658 | ||
| 666 | retval = kernel_read(bprm->file, elf_ppnt->p_offset, | 659 | retval = kernel_read(bprm->file, elf_ppnt->p_offset, |
| 667 | elf_interpreter, | 660 | elf_interpreter, |
| @@ -956,8 +949,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
| 956 | 949 | ||
| 957 | kfree(elf_phdata); | 950 | kfree(elf_phdata); |
| 958 | 951 | ||
| 959 | sys_close(elf_exec_fileno); | ||
| 960 | |||
| 961 | set_binfmt(&elf_format); | 952 | set_binfmt(&elf_format); |
| 962 | 953 | ||
| 963 | #ifdef ARCH_HAS_SETUP_ADDITIONAL_PAGES | 954 | #ifdef ARCH_HAS_SETUP_ADDITIONAL_PAGES |
| @@ -1028,8 +1019,6 @@ out_free_dentry: | |||
| 1028 | fput(interpreter); | 1019 | fput(interpreter); |
| 1029 | out_free_interp: | 1020 | out_free_interp: |
| 1030 | kfree(elf_interpreter); | 1021 | kfree(elf_interpreter); |
| 1031 | out_free_file: | ||
| 1032 | sys_close(elf_exec_fileno); | ||
| 1033 | out_free_ph: | 1022 | out_free_ph: |
| 1034 | kfree(elf_phdata); | 1023 | kfree(elf_phdata); |
| 1035 | goto out; | 1024 | goto out; |
