diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-08-18 22:08:20 -0400 |
---|---|---|
committer | Sasha Levin <alexander.levin@verizon.com> | 2016-10-05 22:40:20 -0400 |
commit | 9a34b2a78d804cc01704de334d6795b71555a9e1 (patch) | |
tree | 353243881f720f24642c185a1d34b3c76ec99562 | |
parent | ddc84f7b3093f0e29252f155d74191fef3746a86 (diff) | |
download | lwn-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.h | 3 |
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; } |