summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-08-18 22:08:20 -0400
committerSasha Levin <alexander.levin@verizon.com>2016-10-05 22:40:20 -0400
commit9a34b2a78d804cc01704de334d6795b71555a9e1 (patch)
tree353243881f720f24642c185a1d34b3c76ec99562
parentddc84f7b3093f0e29252f155d74191fef3746a86 (diff)
downloadlwn-9a34b2a78d804cc01704de334d6795b71555a9e1.tar.gz
lwn-9a34b2a78d804cc01704de334d6795b71555a9e1.zip
metag: copy_from_user() should zero the destination on access_ok() failure
[ Upstream commit 8ae95ed4ae5fc7c3391ed668b2014c9e2079533b ] Cc: stable@vger.kernel.org Acked-by: James Hogan <james.hogan@imgtec.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
-rw-r--r--arch/metag/include/asm/uaccess.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/metag/include/asm/uaccess.h b/arch/metag/include/asm/uaccess.h
index 0748b0a97986..7841f2290385 100644
--- a/arch/metag/include/asm/uaccess.h
+++ b/arch/metag/include/asm/uaccess.h
@@ -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;
}