diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-09-14 12:35:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-09-14 12:35:05 -0400 |
commit | 77e5bdf9f7b2d20939c8d807f3e68778d6e1557a (patch) | |
tree | 377970d3aeae627a6a5ff9b78eaa5e8a1feca3cc /arch/parisc | |
parent | b8f26e880c8166604e0da741eccd9fe6d8e1b9fb (diff) | |
parent | 8630c32275bac2de6ffb8aea9d9b11663e7ad28e (diff) |
Merge branch 'uaccess-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull uaccess fixes from Al Viro:
"Fixes for broken uaccess primitives - mostly lack of proper zeroing
in copy_from_user()/get_user()/__get_user(), but for several
architectures there's more (broken clear_user() on frv and
strncpy_from_user() on hexagon)"
* 'uaccess-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (28 commits)
avr32: fix copy_from_user()
microblaze: fix __get_user()
microblaze: fix copy_from_user()
m32r: fix __get_user()
blackfin: fix copy_from_user()
sparc32: fix copy_from_user()
sh: fix copy_from_user()
sh64: failing __get_user() should zero
score: fix copy_from_user() and friends
score: fix __get_user/get_user
s390: get_user() should zero on failure
ppc32: fix copy_from_user()
parisc: fix copy_from_user()
openrisc: fix copy_from_user()
nios2: fix __get_user()
nios2: copy_from_user() should zero the tail of destination
mn10300: copy_from_user() should zero on access_ok() failure...
mn10300: failing __get_user() and get_user() should zero
mips: copy_from_user() must zero the destination on access_ok() failure
ARC: uaccess: get_user to zero out dest in cause of fault
...
Diffstat (limited to 'arch/parisc')
-rw-r--r-- | arch/parisc/include/asm/uaccess.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h index e9150487e20d..482847865dac 100644 --- a/arch/parisc/include/asm/uaccess.h +++ b/arch/parisc/include/asm/uaccess.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <asm-generic/uaccess-unaligned.h> | 10 | #include <asm-generic/uaccess-unaligned.h> |
11 | 11 | ||
12 | #include <linux/bug.h> | 12 | #include <linux/bug.h> |
13 | #include <linux/string.h> | ||
13 | 14 | ||
14 | #define VERIFY_READ 0 | 15 | #define VERIFY_READ 0 |
15 | #define VERIFY_WRITE 1 | 16 | #define VERIFY_WRITE 1 |
@@ -221,7 +222,7 @@ static inline unsigned long __must_check copy_from_user(void *to, | |||
221 | unsigned long n) | 222 | unsigned long n) |
222 | { | 223 | { |
223 | int sz = __compiletime_object_size(to); | 224 | int sz = __compiletime_object_size(to); |
224 | int ret = -EFAULT; | 225 | unsigned long ret = n; |
225 | 226 | ||
226 | if (likely(sz == -1 || sz >= n)) | 227 | if (likely(sz == -1 || sz >= n)) |
227 | ret = __copy_from_user(to, from, n); | 228 | ret = __copy_from_user(to, from, n); |
@@ -230,6 +231,8 @@ static inline unsigned long __must_check copy_from_user(void *to, | |||
230 | else | 231 | else |
231 | __bad_copy_user(); | 232 | __bad_copy_user(); |
232 | 233 | ||
234 | if (unlikely(ret)) | ||
235 | memset(to + (n - ret), 0, ret); | ||
233 | return ret; | 236 | return ret; |
234 | } | 237 | } |
235 | 238 | ||