summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/checksum_32.h
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2020-02-17 00:50:00 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2020-05-29 23:11:48 +0300
commit0a5ea224b2fdf9dca9291ef7b5a12fd846a5dc34 (patch)
tree1a4dac4be2cf16690a41bf9e80cb34d812df7c80 /arch/x86/include/asm/checksum_32.h
parent73e800ecb67bf24c0508c63350c1dc509f00b1ce (diff)
downloadlinux-0a5ea224b2fdf9dca9291ef7b5a12fd846a5dc34.tar.xz
x86: switch both 32bit and 64bit to providing csum_and_copy_from_user()
... rather than messing with the wrapper. As a side effect, 32bit variant gets access_ok() into it and can be switched to user_access_begin()/user_access_end() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/x86/include/asm/checksum_32.h')
-rw-r--r--arch/x86/include/asm/checksum_32.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/arch/x86/include/asm/checksum_32.h b/arch/x86/include/asm/checksum_32.h
index f57b94e02c57..2487b7fc2d24 100644
--- a/arch/x86/include/asm/checksum_32.h
+++ b/arch/x86/include/asm/checksum_32.h
@@ -44,18 +44,21 @@ static inline __wsum csum_partial_copy_nocheck(const void *src, void *dst,
return csum_partial_copy_generic(src, dst, len, sum, NULL, NULL);
}
-static inline __wsum csum_partial_copy_from_user(const void __user *src,
- void *dst,
- int len, __wsum sum,
- int *err_ptr)
+static inline __wsum csum_and_copy_from_user(const void __user *src,
+ void *dst, int len,
+ __wsum sum, int *err_ptr)
{
__wsum ret;
might_sleep();
- stac();
+ if (!user_access_begin(src, len)) {
+ if (len)
+ *err_ptr = -EFAULT;
+ return sum;
+ }
ret = csum_partial_copy_generic((__force void *)src, dst,
len, sum, err_ptr, NULL);
- clac();
+ user_access_end();
return ret;
}