osf_wait4(): fix infoleak
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 15 May 2017 01:47:25 +0000 (21:47 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 21 May 2017 17:10:07 +0000 (13:10 -0400)
failing sys_wait4() won't fill struct rusage...

Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
arch/alpha/kernel/osf_sys.c

index 9ec56dc973749555019f5f0087727cc1bb97881a..ce93124a850be26520524579d30188e1ba5fcee6 100644 (file)
@@ -1201,8 +1201,10 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options,
        if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur)))
                return -EFAULT;
 
-       err = 0;
-       err |= put_user(status, ustatus);
+       err = put_user(status, ustatus);
+       if (ret < 0)
+               return err ? err : ret;
+
        err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec);
        err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec);
        err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);