Commit dcce0cca authored by David S. Miller's avatar David S. Miller

Sparc64: Propagate exec MM handling changes to sparc32 emulation layer.

parent 2ae37079
...@@ -2879,16 +2879,19 @@ do_execve32(char * filename, u32 * argv, u32 * envp, struct pt_regs * regs) ...@@ -2879,16 +2879,19 @@ do_execve32(char * filename, u32 * argv, u32 * envp, struct pt_regs * regs)
bprm.sh_bang = 0; bprm.sh_bang = 0;
bprm.loader = 0; bprm.loader = 0;
bprm.exec = 0; bprm.exec = 0;
if ((bprm.argc = count32(argv, bprm.p / sizeof(u32))) < 0) {
allow_write_access(file); bprm.mm = mm_alloc();
fput(file); retval = -ENOMEM;
return bprm.argc; if (!bprm.mm)
} goto out_file;
if ((bprm.envc = count32(envp, bprm.p / sizeof(u32))) < 0) {
allow_write_access(file); bprm.argc = count32(argv, bprm.p / sizeof(u32));
fput(file); if ((retval = bprm.argc) < 0)
return bprm.envc; goto out_mm;
}
bprm.envc = count32(envp, bprm.p / sizeof(u32));
if ((retval = bprm.envc) < 0)
goto out_mm;
retval = prepare_binprm(&bprm); retval = prepare_binprm(&bprm);
if (retval < 0) if (retval < 0)
...@@ -2914,14 +2917,20 @@ do_execve32(char * filename, u32 * argv, u32 * envp, struct pt_regs * regs) ...@@ -2914,14 +2917,20 @@ do_execve32(char * filename, u32 * argv, u32 * envp, struct pt_regs * regs)
out: out:
/* Something went wrong, return the inode and free the argument pages*/ /* Something went wrong, return the inode and free the argument pages*/
allow_write_access(bprm.file); for (i = 0 ; i < MAX_ARG_PAGES ; i++) {
if (bprm.file) struct page * page = bprm.page[i];
fput(bprm.file); if (page)
__free_page(page);
}
for (i=0 ; i<MAX_ARG_PAGES ; i++) out_mm:
if (bprm.page[i]) mmdrop(bprm.mm);
__free_page(bprm.page[i]);
out_file:
if (bprm.file) {
allow_write_access(bprm.file);
fput(bprm.file);
}
return retval; return retval;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment