lkml.org 
[lkml]   [2017]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] waitid(): Avoid unbalanced user_access_end() on access_ok() error
From
Date
On 10/20/2017 07:36 AM, Kees Cook wrote:
> As pointed out by Linus and David, the earlier waitid() fix resulted in a
> (currently harmless) unbalanced user_access_end() call. This fixes it to
> just directly return EFAULT on access_ok() failure.
>
> Fixes: 96ca579a1ecc ("waitid(): Add missing access_ok() checks")
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: David Daney <ddaney@caviumnetworks.com>
> Signed-off-by: Kees Cook <keescook@chromium.org>

Thanks Kees, this looks better to me ...

Acked-by: David Daney <david.daney@cavium.com>

> ---
> This seems best to get fixed up now (in the same release where it was
> introduced) before it tries to bite us at some later time.
> ---
> kernel/exit.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/exit.c b/kernel/exit.c
> index cf28528842bc..f6cad39f35df 100644
> --- a/kernel/exit.c
> +++ b/kernel/exit.c
> @@ -1611,7 +1611,7 @@ SYSCALL_DEFINE5(waitid, int, which, pid_t, upid, struct siginfo __user *,
> return err;
>
> if (!access_ok(VERIFY_WRITE, infop, sizeof(*infop)))
> - goto Efault;
> + return -EFAULT;
>
> user_access_begin();
> unsafe_put_user(signo, &infop->si_signo, Efault);
> @@ -1739,7 +1739,7 @@ COMPAT_SYSCALL_DEFINE5(waitid,
> return err;
>
> if (!access_ok(VERIFY_WRITE, infop, sizeof(*infop)))
> - goto Efault;
> + return -EFAULT;
>
> user_access_begin();
> unsafe_put_user(signo, &infop->si_signo, Efault);
>

\
 
 \ /
  Last update: 2017-10-22 17:42    [W:0.042 / U:0.476 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site