Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 143829
b: refs/heads/master
c: 8c652f9
h: refs/heads/master
i:
  143827: 61d4dcf
v: v3
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Apr 24, 2009
1 parent 4296477 commit 310b3a2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 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: 091069740304c979f957ceacec39c461d0192158
refs/heads/master: 8c652f96d3852b97a49c331cd0bb02d22f3cb31b
11 changes: 5 additions & 6 deletions trunk/fs/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1476,6 +1476,7 @@ int compat_do_execve(char * filename,
struct linux_binprm *bprm;
struct file *file;
struct files_struct *displaced;
bool clear_in_exec;
int retval;

retval = unshare_files(&displaced);
Expand All @@ -1498,8 +1499,9 @@ int compat_do_execve(char * filename,
goto out_unlock;

retval = check_unsafe_exec(bprm);
if (retval)
if (retval < 0)
goto out_unlock;
clear_in_exec = retval;

file = open_exec(filename);
retval = PTR_ERR(file);
Expand Down Expand Up @@ -1546,9 +1548,7 @@ int compat_do_execve(char * filename,
goto out;

/* execve succeeded */
write_lock(&current->fs->lock);
current->fs->in_exec = 0;
write_unlock(&current->fs->lock);
current->in_execve = 0;
mutex_unlock(&current->cred_exec_mutex);
acct_update_integrals(current);
Expand All @@ -1568,9 +1568,8 @@ int compat_do_execve(char * filename,
}

out_unmark:
write_lock(&current->fs->lock);
current->fs->in_exec = 0;
write_unlock(&current->fs->lock);
if (clear_in_exec)
current->fs->in_exec = 0;

out_unlock:
current->in_execve = 0;
Expand Down
19 changes: 10 additions & 9 deletions trunk/fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1077,9 +1077,11 @@ int check_unsafe_exec(struct linux_binprm *bprm)
if (p->fs->users > n_fs) {
bprm->unsafe |= LSM_UNSAFE_SHARE;
} else {
if (p->fs->in_exec)
res = -EAGAIN;
p->fs->in_exec = 1;
res = -EAGAIN;
if (!p->fs->in_exec) {
p->fs->in_exec = 1;
res = 1;
}
}

unlock_task_sighand(p, &flags);
Expand Down Expand Up @@ -1284,6 +1286,7 @@ int do_execve(char * filename,
struct linux_binprm *bprm;
struct file *file;
struct files_struct *displaced;
bool clear_in_exec;
int retval;

retval = unshare_files(&displaced);
Expand All @@ -1306,8 +1309,9 @@ int do_execve(char * filename,
goto out_unlock;

retval = check_unsafe_exec(bprm);
if (retval)
if (retval < 0)
goto out_unlock;
clear_in_exec = retval;

file = open_exec(filename);
retval = PTR_ERR(file);
Expand Down Expand Up @@ -1355,9 +1359,7 @@ int do_execve(char * filename,
goto out;

/* execve succeeded */
write_lock(&current->fs->lock);
current->fs->in_exec = 0;
write_unlock(&current->fs->lock);
current->in_execve = 0;
mutex_unlock(&current->cred_exec_mutex);
acct_update_integrals(current);
Expand All @@ -1377,9 +1379,8 @@ int do_execve(char * filename,
}

out_unmark:
write_lock(&current->fs->lock);
current->fs->in_exec = 0;
write_unlock(&current->fs->lock);
if (clear_in_exec)
current->fs->in_exec = 0;

out_unlock:
current->in_execve = 0;
Expand Down

0 comments on commit 310b3a2

Please sign in to comment.