aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/include/asm/checksum.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/arch/mips/include/asm/checksum.h b/arch/mips/include/asm/checksum.h
index 3c9aea55954f..f5602c6957c7 100644
--- a/arch/mips/include/asm/checksum.h
+++ b/arch/mips/include/asm/checksum.h
@@ -37,7 +37,6 @@ __wsum __csum_partial_copy_from_user(const void *src, void *dst,
37 int len, __wsum sum, int *err_ptr); 37 int len, __wsum sum, int *err_ptr);
38__wsum __csum_partial_copy_to_user(const void *src, void *dst, 38__wsum __csum_partial_copy_to_user(const void *src, void *dst,
39 int len, __wsum sum, int *err_ptr); 39 int len, __wsum sum, int *err_ptr);
40
41/* 40/*
42 * this is a new version of the above that records errors it finds in *errp, 41 * this is a new version of the above that records errors it finds in *errp,
43 * but continues and zeros the rest of the buffer. 42 * but continues and zeros the rest of the buffer.
@@ -47,8 +46,12 @@ __wsum csum_partial_copy_from_user(const void __user *src, void *dst, int len,
47 __wsum sum, int *err_ptr) 46 __wsum sum, int *err_ptr)
48{ 47{
49 might_fault(); 48 might_fault();
50 return __csum_partial_copy_from_user((__force void *)src, dst, 49 if (segment_eq(get_fs(), get_ds()))
51 len, sum, err_ptr); 50 return __csum_partial_copy_kernel((__force void *)src, dst,
51 len, sum, err_ptr);
52 else
53 return __csum_partial_copy_from_user((__force void *)src, dst,
54 len, sum, err_ptr);
52} 55}
53 56
54/* 57/*
@@ -60,9 +63,16 @@ __wsum csum_and_copy_to_user(const void *src, void __user *dst, int len,
60 __wsum sum, int *err_ptr) 63 __wsum sum, int *err_ptr)
61{ 64{
62 might_fault(); 65 might_fault();
63 if (access_ok(VERIFY_WRITE, dst, len)) 66 if (access_ok(VERIFY_WRITE, dst, len)) {
64 return __csum_partial_copy_to_user(src, (__force void *)dst, 67 if (segment_eq(get_fs(), get_ds()))
65 len, sum, err_ptr); 68 return __csum_partial_copy_kernel(src,
69 (__force void *)dst,
70 len, sum, err_ptr);
71 else
72 return __csum_partial_copy_to_user(src,
73 (__force void *)dst,
74 len, sum, err_ptr);
75 }
66 if (len) 76 if (len)
67 *err_ptr = -EFAULT; 77 *err_ptr = -EFAULT;
68 78