signal: cleanup sys_sigprocmask()
Cleanup. Remove the unneeded goto's, we can simply read blocked.sig[0] unconditionally and then copy-to-user it if oset != NULL. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Tejun Heo <tj@kernel.org> Reviewed-by: Matt Fleming <matt.fleming@linux.intel.com>
This commit is contained in:
@@ -2889,29 +2889,28 @@ SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, set)
|
|||||||
/**
|
/**
|
||||||
* sys_sigprocmask - examine and change blocked signals
|
* sys_sigprocmask - examine and change blocked signals
|
||||||
* @how: whether to add, remove, or set signals
|
* @how: whether to add, remove, or set signals
|
||||||
* @set: signals to add or remove (if non-null)
|
* @nset: signals to add or remove (if non-null)
|
||||||
* @oset: previous value of signal mask if non-null
|
* @oset: previous value of signal mask if non-null
|
||||||
*
|
*
|
||||||
* Some platforms have their own version with special arguments;
|
* Some platforms have their own version with special arguments;
|
||||||
* others support only sys_rt_sigprocmask.
|
* others support only sys_rt_sigprocmask.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, set,
|
SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, nset,
|
||||||
old_sigset_t __user *, oset)
|
old_sigset_t __user *, oset)
|
||||||
{
|
{
|
||||||
int error;
|
|
||||||
old_sigset_t old_set, new_set;
|
old_sigset_t old_set, new_set;
|
||||||
|
int error;
|
||||||
|
|
||||||
if (set) {
|
old_set = current->blocked.sig[0];
|
||||||
error = -EFAULT;
|
|
||||||
if (copy_from_user(&new_set, set, sizeof(*set)))
|
if (nset) {
|
||||||
goto out;
|
if (copy_from_user(&new_set, nset, sizeof(*nset)))
|
||||||
|
return -EFAULT;
|
||||||
new_set &= ~(sigmask(SIGKILL) | sigmask(SIGSTOP));
|
new_set &= ~(sigmask(SIGKILL) | sigmask(SIGSTOP));
|
||||||
|
|
||||||
spin_lock_irq(¤t->sighand->siglock);
|
|
||||||
old_set = current->blocked.sig[0];
|
|
||||||
|
|
||||||
error = 0;
|
error = 0;
|
||||||
|
spin_lock_irq(¤t->sighand->siglock);
|
||||||
switch (how) {
|
switch (how) {
|
||||||
default:
|
default:
|
||||||
error = -EINVAL;
|
error = -EINVAL;
|
||||||
@@ -2930,19 +2929,15 @@ SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, set,
|
|||||||
recalc_sigpending();
|
recalc_sigpending();
|
||||||
spin_unlock_irq(¤t->sighand->siglock);
|
spin_unlock_irq(¤t->sighand->siglock);
|
||||||
if (error)
|
if (error)
|
||||||
goto out;
|
return error;
|
||||||
if (oset)
|
|
||||||
goto set_old;
|
|
||||||
} else if (oset) {
|
|
||||||
old_set = current->blocked.sig[0];
|
|
||||||
set_old:
|
|
||||||
error = -EFAULT;
|
|
||||||
if (copy_to_user(oset, &old_set, sizeof(*oset)))
|
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
error = 0;
|
|
||||||
out:
|
if (oset) {
|
||||||
return error;
|
if (copy_to_user(oset, &old_set, sizeof(*oset)))
|
||||||
|
return -EFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* __ARCH_WANT_SYS_SIGPROCMASK */
|
#endif /* __ARCH_WANT_SYS_SIGPROCMASK */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user