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>
This commit is contained in:
Al Viro 2009-03-29 16:31:16 -04:00
parent 5ad4e53bd5
commit e7b9b550f5

View file

@ -576,7 +576,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
unsigned long error; unsigned long error;
struct elf_phdr *elf_ppnt, *elf_phdata; struct elf_phdr *elf_ppnt, *elf_phdata;
unsigned long elf_bss, elf_brk; unsigned long elf_bss, elf_brk;
int elf_exec_fileno;
int retval, i; int retval, i;
unsigned int size; unsigned int size;
unsigned long elf_entry; unsigned long elf_entry;
@ -631,12 +630,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
goto out_free_ph; goto out_free_ph;
} }
retval = get_unused_fd();
if (retval < 0)
goto out_free_ph;
get_file(bprm->file);
fd_install(elf_exec_fileno = retval, bprm->file);
elf_ppnt = elf_phdata; elf_ppnt = elf_phdata;
elf_bss = 0; elf_bss = 0;
elf_brk = 0; elf_brk = 0;
@ -655,13 +648,13 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
retval = -ENOEXEC; retval = -ENOEXEC;
if (elf_ppnt->p_filesz > PATH_MAX || if (elf_ppnt->p_filesz > PATH_MAX ||
elf_ppnt->p_filesz < 2) elf_ppnt->p_filesz < 2)
goto out_free_file; goto out_free_ph;
retval = -ENOMEM; retval = -ENOMEM;
elf_interpreter = kmalloc(elf_ppnt->p_filesz, elf_interpreter = kmalloc(elf_ppnt->p_filesz,
GFP_KERNEL); GFP_KERNEL);
if (!elf_interpreter) if (!elf_interpreter)
goto out_free_file; goto out_free_ph;
retval = kernel_read(bprm->file, elf_ppnt->p_offset, retval = kernel_read(bprm->file, elf_ppnt->p_offset,
elf_interpreter, elf_interpreter,
@ -956,8 +949,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
kfree(elf_phdata); kfree(elf_phdata);
sys_close(elf_exec_fileno);
set_binfmt(&elf_format); set_binfmt(&elf_format);
#ifdef ARCH_HAS_SETUP_ADDITIONAL_PAGES #ifdef ARCH_HAS_SETUP_ADDITIONAL_PAGES
@ -1028,8 +1019,6 @@ out_free_dentry:
fput(interpreter); fput(interpreter);
out_free_interp: out_free_interp:
kfree(elf_interpreter); kfree(elf_interpreter);
out_free_file:
sys_close(elf_exec_fileno);
out_free_ph: out_free_ph:
kfree(elf_phdata); kfree(elf_phdata);
goto out; goto out;