Commit 0fe6f5c0 authored by Al Viro's avatar Al Viro Committed by Sasha Levin

sh: fix copy_from_user()

[ Upstream commit 6e050503 ]

Cc: stable@vger.kernel.org
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent dbff5b36
...@@ -151,7 +151,10 @@ copy_from_user(void *to, const void __user *from, unsigned long n) ...@@ -151,7 +151,10 @@ copy_from_user(void *to, const void __user *from, unsigned long n)
__kernel_size_t __copy_size = (__kernel_size_t) n; __kernel_size_t __copy_size = (__kernel_size_t) n;
if (__copy_size && __access_ok(__copy_from, __copy_size)) if (__copy_size && __access_ok(__copy_from, __copy_size))
return __copy_user(to, from, __copy_size); __copy_size = __copy_user(to, from, __copy_size);
if (unlikely(__copy_size))
memset(to + (n - __copy_size), 0, __copy_size);
return __copy_size; return __copy_size;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment