diff options
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -1400,10 +1400,6 @@ int search_binary_handler(struct linux_binprm *bprm) | |||
1400 | bprm->recursion_depth--; | 1400 | bprm->recursion_depth--; |
1401 | if (retval >= 0) { | 1401 | if (retval >= 0) { |
1402 | put_binfmt(fmt); | 1402 | put_binfmt(fmt); |
1403 | allow_write_access(bprm->file); | ||
1404 | if (bprm->file) | ||
1405 | fput(bprm->file); | ||
1406 | bprm->file = NULL; | ||
1407 | return retval; | 1403 | return retval; |
1408 | } | 1404 | } |
1409 | read_lock(&binfmt_lock); | 1405 | read_lock(&binfmt_lock); |
@@ -1455,6 +1451,12 @@ static int exec_binprm(struct linux_binprm *bprm) | |||
1455 | ptrace_event(PTRACE_EVENT_EXEC, old_vpid); | 1451 | ptrace_event(PTRACE_EVENT_EXEC, old_vpid); |
1456 | current->did_exec = 1; | 1452 | current->did_exec = 1; |
1457 | proc_exec_connector(current); | 1453 | proc_exec_connector(current); |
1454 | |||
1455 | if (bprm->file) { | ||
1456 | allow_write_access(bprm->file); | ||
1457 | fput(bprm->file); | ||
1458 | bprm->file = NULL; /* to catch use-after-free */ | ||
1459 | } | ||
1458 | } | 1460 | } |
1459 | 1461 | ||
1460 | return ret; | 1462 | return ret; |