Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 26850
b: refs/heads/master
c: df88912
h: refs/heads/master
v: v3
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed May 21, 2006
1 parent 67b9132 commit 12fabb0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 48d705522da4fa04bb0169a7ca3c9ab92e28b613
refs/heads/master: df88912a2165f56a7402db80126cf8ea075221fe
30 changes: 9 additions & 21 deletions trunk/fs/binfmt_flat.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ static int load_flat_file(struct linux_binprm * bprm,
loff_t fpos;
unsigned long start_code, end_code;
int ret;
int exec_fileno;

hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */
inode = bprm->file->f_dentry->d_inode;
Expand Down Expand Up @@ -502,21 +501,12 @@ static int load_flat_file(struct linux_binprm * bprm,
goto err;
}

/* check file descriptor */
exec_fileno = get_unused_fd();
if (exec_fileno < 0) {
ret = -EMFILE;
goto err;
}
get_file(bprm->file);
fd_install(exec_fileno, bprm->file);

/* Flush all traces of the currently running executable */
if (id == 0) {
result = flush_old_exec(bprm);
if (result) {
ret = result;
goto err_close;
goto err;
}

/* OK, This is the point of no return */
Expand Down Expand Up @@ -548,7 +538,7 @@ static int load_flat_file(struct linux_binprm * bprm,
textpos = (unsigned long) -ENOMEM;
printk("Unable to mmap process text, errno %d\n", (int)-textpos);
ret = textpos;
goto err_close;
goto err;
}

down_write(&current->mm->mmap_sem);
Expand All @@ -564,7 +554,7 @@ static int load_flat_file(struct linux_binprm * bprm,
(int)-datapos);
do_munmap(current->mm, textpos, text_len);
ret = realdatastart;
goto err_close;
goto err;
}
datapos = realdatastart + MAX_SHARED_LIBS * sizeof(unsigned long);

Expand All @@ -587,7 +577,7 @@ static int load_flat_file(struct linux_binprm * bprm,
do_munmap(current->mm, textpos, text_len);
do_munmap(current->mm, realdatastart, data_len + extra);
ret = result;
goto err_close;
goto err;
}

reloc = (unsigned long *) (datapos+(ntohl(hdr->reloc_start)-text_len));
Expand All @@ -606,7 +596,7 @@ static int load_flat_file(struct linux_binprm * bprm,
printk("Unable to allocate RAM for process text/data, errno %d\n",
(int)-textpos);
ret = textpos;
goto err_close;
goto err;
}

realdatastart = textpos + ntohl(hdr->data_start);
Expand Down Expand Up @@ -652,7 +642,7 @@ static int load_flat_file(struct linux_binprm * bprm,
do_munmap(current->mm, textpos, text_len + data_len + extra +
MAX_SHARED_LIBS * sizeof(unsigned long));
ret = result;
goto err_close;
goto err;
}
}

Expand Down Expand Up @@ -717,7 +707,7 @@ static int load_flat_file(struct linux_binprm * bprm,
addr = calc_reloc(*rp, libinfo, id, 0);
if (addr == RELOC_FAILED) {
ret = -ENOEXEC;
goto err_close;
goto err;
}
*rp = addr;
}
Expand Down Expand Up @@ -747,7 +737,7 @@ static int load_flat_file(struct linux_binprm * bprm,
rp = (unsigned long *) calc_reloc(addr, libinfo, id, 1);
if (rp == (unsigned long *)RELOC_FAILED) {
ret = -ENOEXEC;
goto err_close;
goto err;
}

/* Get the pointer's value. */
Expand All @@ -762,7 +752,7 @@ static int load_flat_file(struct linux_binprm * bprm,
addr = calc_reloc(addr, libinfo, id, 0);
if (addr == RELOC_FAILED) {
ret = -ENOEXEC;
goto err_close;
goto err;
}

/* Write back the relocated pointer. */
Expand All @@ -783,8 +773,6 @@ static int load_flat_file(struct linux_binprm * bprm,
stack_len);

return 0;
err_close:
sys_close(exec_fileno);
err:
return ret;
}
Expand Down

0 comments on commit 12fabb0

Please sign in to comment.