projects
/
cascardo
/
linux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge tag 'usercopy-v4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
[cascardo/linux.git]
/
arch
/
x86
/
include
/
asm
/
uaccess.h
diff --git
a/arch/x86/include/asm/uaccess.h
b/arch/x86/include/asm/uaccess.h
index
52f2300
..
a0ae610
100644
(file)
--- a/
arch/x86/include/asm/uaccess.h
+++ b/
arch/x86/include/asm/uaccess.h
@@
-761,9
+761,10
@@
copy_from_user(void *to, const void __user *from, unsigned long n)
* case, and do only runtime checking for non-constant sizes.
*/
* case, and do only runtime checking for non-constant sizes.
*/
- if (likely(sz < 0 || sz >= n))
+ if (likely(sz < 0 || sz >= n)) {
+ check_object_size(to, n, false);
n = _copy_from_user(to, from, n);
n = _copy_from_user(to, from, n);
-
else if
(__builtin_constant_p(n))
+
} else if
(__builtin_constant_p(n))
copy_from_user_overflow();
else
__copy_from_user_overflow(sz, n);
copy_from_user_overflow();
else
__copy_from_user_overflow(sz, n);
@@
-781,9
+782,10
@@
copy_to_user(void __user *to, const void *from, unsigned long n)
might_fault();
/* See the comment in copy_from_user() above. */
might_fault();
/* See the comment in copy_from_user() above. */
- if (likely(sz < 0 || sz >= n))
+ if (likely(sz < 0 || sz >= n)) {
+ check_object_size(from, n, true);
n = _copy_to_user(to, from, n);
n = _copy_to_user(to, from, n);
-
else if
(__builtin_constant_p(n))
+
} else if
(__builtin_constant_p(n))
copy_to_user_overflow();
else
__copy_to_user_overflow(sz, n);
copy_to_user_overflow();
else
__copy_to_user_overflow(sz, n);