Commit 96ca579a authored by Kees Cook's avatar Kees Cook Committed by Linus Torvalds

waitid(): Add missing access_ok() checks

Adds missing access_ok() checks.

CVE-2017-5123
Reported-by: default avatarChris Salls <chrissalls5@gmail.com>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Acked-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Fixes: 4c48abe9 ("waitid(): switch copyout of siginfo to unsafe_put_user()")
Cc: stable@kernel.org # 4.13
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ff33952e
...@@ -1610,6 +1610,9 @@ SYSCALL_DEFINE5(waitid, int, which, pid_t, upid, struct siginfo __user *, ...@@ -1610,6 +1610,9 @@ SYSCALL_DEFINE5(waitid, int, which, pid_t, upid, struct siginfo __user *,
if (!infop) if (!infop)
return err; return err;
if (!access_ok(VERIFY_WRITE, infop, sizeof(*infop)))
goto Efault;
user_access_begin(); user_access_begin();
unsafe_put_user(signo, &infop->si_signo, Efault); unsafe_put_user(signo, &infop->si_signo, Efault);
unsafe_put_user(0, &infop->si_errno, Efault); unsafe_put_user(0, &infop->si_errno, Efault);
...@@ -1735,6 +1738,9 @@ COMPAT_SYSCALL_DEFINE5(waitid, ...@@ -1735,6 +1738,9 @@ COMPAT_SYSCALL_DEFINE5(waitid,
if (!infop) if (!infop)
return err; return err;
if (!access_ok(VERIFY_WRITE, infop, sizeof(*infop)))
goto Efault;
user_access_begin(); user_access_begin();
unsafe_put_user(signo, &infop->si_signo, Efault); unsafe_put_user(signo, &infop->si_signo, Efault);
unsafe_put_user(0, &infop->si_errno, Efault); unsafe_put_user(0, &infop->si_errno, Efault);
......
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