aboutsummaryrefslogtreecommitdiffstats
path: root/fs/binfmt_elf.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2009-03-29 16:31:16 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2009-03-31 23:00:27 -0400
commite7b9b550f53e81ea38e71d322d6f95730df058a2 (patch)
tree2df697e6757a4af427c1aeb05ba0af5cd8f738ca /fs/binfmt_elf.c
parent5ad4e53bd5406ee214ddc5a41f03f779b8b2d526 (diff)
Don't mess with descriptor table in load_elf_binary()
... since we don't tell anyone which descriptor does the file get. We used to, but only in case of ELF binary with a.out loader and that stuff has been gone for a while. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/binfmt_elf.c')
-rw-r--r--fs/binfmt_elf.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 33b7235f853b..10462efe5a13 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);
1029out_free_interp: 1020out_free_interp:
1030 kfree(elf_interpreter); 1021 kfree(elf_interpreter);
1031out_free_file:
1032 sys_close(elf_exec_fileno);
1033out_free_ph: 1022out_free_ph:
1034 kfree(elf_phdata); 1023 kfree(elf_phdata);
1035 goto out; 1024 goto out;