summaryrefslogtreecommitdiffstats
path: root/kernel/exit.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2017-05-14 19:27:32 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2017-05-21 13:16:18 -0400
commit4c48abe91be03d191d0c20cc755877da2cb35622 (patch)
tree22c13f3cb38d7c6978bd37741c552c79e13b48d2 /kernel/exit.c
parent76d9871e1122aabc086e7aade5251b1e5124cbb9 (diff)
downloadlinux-4c48abe91be03d191d0c20cc755877da2cb35622.tar.bz2
waitid(): switch copyout of siginfo to unsafe_put_user()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel/exit.c')
-rw-r--r--kernel/exit.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index 97db9ee03f90..f3b8c3a87bc1 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1625,15 +1625,18 @@ SYSCALL_DEFINE5(waitid, int, which, pid_t, upid, struct siginfo __user *,
if (!infop)
return err;
- if (put_user(err ? 0 : SIGCHLD, &infop->si_signo) ||
- put_user(0, &infop->si_errno) ||
- put_user((short)info.cause, &infop->si_code) ||
- put_user(info.pid, &infop->si_pid) ||
- put_user(info.uid, &infop->si_uid) ||
- put_user(info.status, &infop->si_status))
- err = -EFAULT;
-
+ user_access_begin();
+ unsafe_put_user(err ? 0 : SIGCHLD, &infop->si_signo, Efault);
+ unsafe_put_user(0, &infop->si_errno, Efault);
+ unsafe_put_user((short)info.cause, &infop->si_code, Efault);
+ unsafe_put_user(info.pid, &infop->si_pid, Efault);
+ unsafe_put_user(info.uid, &infop->si_uid, Efault);
+ unsafe_put_user(info.status, &infop->si_status, Efault);
+ user_access_end();
return err;
+Efault:
+ user_access_end();
+ return -EFAULT;
}
static long kernel_wait4(pid_t upid, int __user *stat_addr,
@@ -1736,13 +1739,20 @@ COMPAT_SYSCALL_DEFINE5(waitid,
return -EFAULT;
}
- if (put_user(err ? 0 : SIGCHLD, &infop->si_signo) ||
- put_user(0, &infop->si_errno) ||
- put_user((short)info.cause, &infop->si_code) ||
- put_user(info.pid, &infop->si_pid) ||
- put_user(info.uid, &infop->si_uid) ||
- put_user(info.status, &infop->si_status))
- err = -EFAULT;
+ if (!infop)
+ return err;
+
+ user_access_begin();
+ unsafe_put_user(err ? 0 : SIGCHLD, &infop->si_signo, Efault);
+ unsafe_put_user(0, &infop->si_errno, Efault);
+ unsafe_put_user((short)info.cause, &infop->si_code, Efault);
+ unsafe_put_user(info.pid, &infop->si_pid, Efault);
+ unsafe_put_user(info.uid, &infop->si_uid, Efault);
+ unsafe_put_user(info.status, &infop->si_status, Efault);
+ user_access_end();
return err;
+Efault:
+ user_access_end();
+ return -EFAULT;
}
#endif