Commit 9a34b2a7 authored by Al Viro's avatar Al Viro Committed by Sasha Levin

metag: copy_from_user() should zero the destination on access_ok() failure

[ Upstream commit 8ae95ed4 ]

Cc: stable@vger.kernel.org
Acked-by: default avatarJames Hogan <james.hogan@imgtec.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent ddc84f7b
......@@ -199,8 +199,9 @@ extern unsigned long __must_check __copy_user_zeroing(void *to,
static inline unsigned long
copy_from_user(void *to, const void __user *from, unsigned long n)
{
if (access_ok(VERIFY_READ, from, n))
if (likely(access_ok(VERIFY_READ, from, n)))
return __copy_user_zeroing(to, from, n);
memset(to, 0, n);
return n;
}
......
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