summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-08-19 05:08:20 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2016-09-14 00:49:40 +0300
commit8ae95ed4ae5fc7c3391ed668b2014c9e2079533b (patch)
tree0b001415a2d4ab39d8e165a63407b5dcfec394d5
parenta5e541f796f17228793694d64b507f5f57db4cd7 (diff)
downloadlinux-8ae95ed4ae5fc7c3391ed668b2014c9e2079533b.tar.xz
metag: copy_from_user() should zero the destination on access_ok() failure
Cc: stable@vger.kernel.org Acked-by: James Hogan <james.hogan@imgtec.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-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 8282cbce7e39..273e61225c27 100644
--- a/arch/metag/include/asm/uaccess.h
+++ b/arch/metag/include/asm/uaccess.h
@@ -204,8 +204,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;
}