Skip to content

Commit

Permalink
cred_guard_mutex: do not return -EINTR to user-space
Browse files Browse the repository at this point in the history
do_execve() and ptrace_attach() return -EINTR if
mutex_lock_interruptible(->cred_guard_mutex) fails.

This is not right, change the code to return ERESTARTNOINTR.

Perhaps we should also change proc_pid_attr_write().

Signed-off-by: Oleg Nesterov <[email protected]>
Cc: David Howells <[email protected]>
Acked-by: Roland McGrath <[email protected]>
Cc: James Morris <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
oleg-nesterov authored and torvalds committed Jul 6, 2009
1 parent 82e3310 commit 793285f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions fs/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1486,8 +1486,8 @@ int compat_do_execve(char * filename,
if (!bprm)
goto out_files;

retval = mutex_lock_interruptible(&current->cred_guard_mutex);
if (retval < 0)
retval = -ERESTARTNOINTR;
if (mutex_lock_interruptible(&current->cred_guard_mutex))
goto out_free;
current->in_execve = 1;

Expand Down
4 changes: 2 additions & 2 deletions fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1277,8 +1277,8 @@ int do_execve(char * filename,
if (!bprm)
goto out_files;

retval = mutex_lock_interruptible(&current->cred_guard_mutex);
if (retval < 0)
retval = -ERESTARTNOINTR;
if (mutex_lock_interruptible(&current->cred_guard_mutex))
goto out_free;
current->in_execve = 1;

Expand Down
4 changes: 2 additions & 2 deletions kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ int ptrace_attach(struct task_struct *task)
* interference; SUID, SGID and LSM creds get determined differently
* under ptrace.
*/
retval = mutex_lock_interruptible(&task->cred_guard_mutex);
if (retval < 0)
retval = -ERESTARTNOINTR;
if (mutex_lock_interruptible(&task->cred_guard_mutex))
goto out;

task_lock(task);
Expand Down

0 comments on commit 793285f

Please sign in to comment.