summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-08-18 22:08:20 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-09-24 10:09:40 +0200
commit462578faf789323dcf73602faed69624f50405a0 (patch)
treeb36b509d8a4c8753e7acebdf845ca61feb0f0198 /arch
parentf79347fedb973dc7e420631f9506c5f26e21395b (diff)
downloadlwn-462578faf789323dcf73602faed69624f50405a0.tar.gz
lwn-462578faf789323dcf73602faed69624f50405a0.zip
metag: copy_from_user() should zero the destination on access_ok() failure
commit 8ae95ed4ae5fc7c3391ed668b2014c9e2079533b upstream. Acked-by: James Hogan <james.hogan@imgtec.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch')
-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;
}