[PATCH 4.4 110/118] metag: copy_from_user() should zero the destination on access_ok() failure
4.4-stable review patch. If anyone has any objections, please let me know. -- From: Al Virocommit 8ae95ed4ae5fc7c3391ed668b2014c9e2079533b upstream. Acked-by: James Hogan Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman --- arch/metag/include/asm/uaccess.h |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/metag/include/asm/uaccess.h +++ b/arch/metag/include/asm/uaccess.h @@ -204,8 +204,9 @@ extern unsigned long __must_check __copy 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; }
[PATCH 4.4 110/118] metag: copy_from_user() should zero the destination on access_ok() failure
4.4-stable review patch. If anyone has any objections, please let me know. -- From: Al Viro commit 8ae95ed4ae5fc7c3391ed668b2014c9e2079533b upstream. Acked-by: James Hogan Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman --- arch/metag/include/asm/uaccess.h |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/metag/include/asm/uaccess.h +++ b/arch/metag/include/asm/uaccess.h @@ -204,8 +204,9 @@ extern unsigned long __must_check __copy 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; }