Commit d8f993b3 authored by Christian Brauner's avatar Christian Brauner Committed by Linus Torvalds

signal: simplify rt_sigaction()

The goto is not needed and does not add any clarity.  Simply return
-EINVAL on unexpected sigset_t struct size directly.

Link: http://lkml.kernel.org/r/20180602103653.18181-6-christian@brauner.ioSigned-off-by: default avatarChristian Brauner <christian@brauner.io>
Acked-by: default avatarOleg Nesterov <oleg@redhat.com>
Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: James Morris <james.morris@microsoft.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b1d294c8
...@@ -3648,25 +3648,23 @@ SYSCALL_DEFINE4(rt_sigaction, int, sig, ...@@ -3648,25 +3648,23 @@ SYSCALL_DEFINE4(rt_sigaction, int, sig,
size_t, sigsetsize) size_t, sigsetsize)
{ {
struct k_sigaction new_sa, old_sa; struct k_sigaction new_sa, old_sa;
int ret = -EINVAL; int ret;
/* XXX: Don't preclude handling different sized sigset_t's. */ /* XXX: Don't preclude handling different sized sigset_t's. */
if (sigsetsize != sizeof(sigset_t)) if (sigsetsize != sizeof(sigset_t))
goto out; return -EINVAL;
if (act) { if (act && copy_from_user(&new_sa.sa, act, sizeof(new_sa.sa)))
if (copy_from_user(&new_sa.sa, act, sizeof(new_sa.sa))) return -EFAULT;
return -EFAULT;
}
ret = do_sigaction(sig, act ? &new_sa : NULL, oact ? &old_sa : NULL); ret = do_sigaction(sig, act ? &new_sa : NULL, oact ? &old_sa : NULL);
if (ret)
return ret;
if (!ret && oact) { if (oact && copy_to_user(oact, &old_sa.sa, sizeof(old_sa.sa)))
if (copy_to_user(oact, &old_sa.sa, sizeof(old_sa.sa))) return -EFAULT;
return -EFAULT;
} return 0;
out:
return ret;
} }
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
COMPAT_SYSCALL_DEFINE4(rt_sigaction, int, sig, COMPAT_SYSCALL_DEFINE4(rt_sigaction, int, sig,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment