diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-08-18 22:08:20 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-09-24 10:07:45 +0200 |
commit | 312357440573be806fcaf4b2fb0c36078476ec30 (patch) | |
tree | 8a5fddba654ef72f49b41fbb78b571ae10d6d91a /arch | |
parent | 0883ebba7a459ff06ec305b1694bcc17424209bf (diff) | |
download | lwn-312357440573be806fcaf4b2fb0c36078476ec30.tar.gz lwn-312357440573be806fcaf4b2fb0c36078476ec30.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.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, 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; } |