Skip to content

Commit 8ae95ed

Browse files
author
Al Viro
committed
metag: copy_from_user() should zero the destination on access_ok() failure
Cc: [email protected] Acked-by: James Hogan <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent a5e541f commit 8ae95ed

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/metag/include/asm/uaccess.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,9 @@ extern unsigned long __must_check __copy_user_zeroing(void *to,
204204
static inline unsigned long
205205
copy_from_user(void *to, const void __user *from, unsigned long n)
206206
{
207-
if (access_ok(VERIFY_READ, from, n))
207+
if (likely(access_ok(VERIFY_READ, from, n)))
208208
return __copy_user_zeroing(to, from, n);
209+
memset(to, 0, n);
209210
return n;
210211
}
211212

0 commit comments

Comments
 (0)