diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-08-18 22:08:20 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-09-13 17:49:40 -0400 |
commit | 8ae95ed4ae5fc7c3391ed668b2014c9e2079533b (patch) | |
tree | 0b001415a2d4ab39d8e165a63407b5dcfec394d5 | |
parent | a5e541f796f17228793694d64b507f5f57db4cd7 (diff) |
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.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 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, | |||
204 | static inline unsigned long | 204 | static inline unsigned long |
205 | copy_from_user(void *to, const void __user *from, unsigned long n) | 205 | copy_from_user(void *to, const void __user *from, unsigned long n) |
206 | { | 206 | { |
207 | if (access_ok(VERIFY_READ, from, n)) | 207 | if (likely(access_ok(VERIFY_READ, from, n))) |
208 | return __copy_user_zeroing(to, from, n); | 208 | return __copy_user_zeroing(to, from, n); |
209 | memset(to, 0, n); | ||
209 | return n; | 210 | return n; |
210 | } | 211 | } |
211 | 212 | ||