cred_guard_mutex: do not return -EINTR to user-space
authorOleg Nesterov <oleg@redhat.com>
Sun, 5 Jul 2009 19:08:26 +0000 (12:08 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 6 Jul 2009 20:57:04 +0000 (13:57 -0700)
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 <oleg@redhat.com>
Cc: David Howells <dhowells@redhat.com>
Acked-by: Roland McGrath <roland@redhat.com>
Cc: James Morris <jmorris@namei.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/compat.c
fs/exec.c
kernel/ptrace.c

index cdd51a3a7c537cd361d18ab21dabd1eafa4d4445..fbadb947727b1e1e3bcee65bd0db72c2e8ee2e18 100644 (file)
@@ -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;
 
index e639957d7a57a310c12718e8fe3e4f0d9dfe2fe2..4a8849e45b2191ef5a91821ad3b47d0588e7b12b 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -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;
 
index 61c78b2c07baefd768aed903f482ea08d9672200..082c320e4dbf0a4538b064f55814c72246852877 100644 (file)
@@ -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);