diff options
Diffstat (limited to 'fs/exec.c')
| -rw-r--r-- | fs/exec.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/exec.c b/fs/exec.c index dd1c43b6f975..a2e554cdace3 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -1094,26 +1094,26 @@ int do_execve(char * filename, int retval; int i; - file = open_exec(filename); - - retval = PTR_ERR(file); - if (IS_ERR(file)) - return retval; - - sched_exec(); - retval = -ENOMEM; bprm = kmalloc(sizeof(*bprm), GFP_KERNEL); if (!bprm) goto out_ret; memset(bprm, 0, sizeof(*bprm)); + file = open_exec(filename); + retval = PTR_ERR(file); + if (IS_ERR(file)) + goto out_kfree; + + sched_exec(); + bprm->p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *); bprm->file = file; bprm->filename = filename; bprm->interp = filename; bprm->mm = mm_alloc(); + retval = -ENOMEM; if (!bprm->mm) goto out_file; @@ -1180,6 +1180,8 @@ out_file: allow_write_access(bprm->file); fput(bprm->file); } + +out_kfree: kfree(bprm); out_ret: |
