Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 793285fc authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds
Browse files

cred_guard_mutex: do not return -EINTR to user-space



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: default avatarOleg Nesterov <oleg@redhat.com>
Cc: David Howells <dhowells@redhat.com>
Acked-by: default avatarRoland McGrath <roland@redhat.com>
Cc: James Morris <jmorris@namei.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 82e3310a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;

+2 −2
Original line number Diff line number Diff line
@@ -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;

+2 −2
Original line number Diff line number Diff line
@@ -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);