um: missing checks of __put_user()/__get_user() return values
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 22 Apr 2012 20:34:27 +0000 (16:34 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 21 May 2012 20:29:02 +0000 (16:29 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
arch/x86/um/signal.c
arch/x86/um/syscalls_32.c

index 35b283d3df0c33ea4e3a6c3003b145fc714c89e1..bb0fb03b9f85f268912e7b6851f74787c8ee8e4a 100644 (file)
@@ -544,8 +544,8 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
                               set->sig[0]);
        err |= __put_user(&frame->fpstate, &frame->uc.uc_mcontext.fpstate);
        if (sizeof(*set) == 16) {
-               __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]);
-               __put_user(set->sig[1], &frame->uc.uc_sigmask.sig[1]);
+               err |= __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]);
+               err |= __put_user(set->sig[1], &frame->uc.uc_sigmask.sig[1]);
        }
        else
                err |= __copy_to_user(&frame->uc.uc_sigmask, set,
index 70ca357393b86fb747895d1a11110324ccd1a4cf..b853e8600b9dc1d00e74151a7e16b8af61a8bfda 100644 (file)
@@ -44,10 +44,10 @@ long sys_sigaction(int sig, const struct old_sigaction __user *act,
                old_sigset_t mask;
                if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
                    __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
-                   __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
+                   __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
+                   __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
+                   __get_user(mask, &act->sa_mask))
                        return -EFAULT;
-               __get_user(new_ka.sa.sa_flags, &act->sa_flags);
-               __get_user(mask, &act->sa_mask);
                siginitset(&new_ka.sa.sa_mask, mask);
        }
 
@@ -56,10 +56,10 @@ long sys_sigaction(int sig, const struct old_sigaction __user *act,
        if (!ret && oact) {
                if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
                    __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
-                   __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
+                   __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
+                   __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
+                   __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
                        return -EFAULT;
-               __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
-               __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
        }
 
        return ret;