Commit fb316913 authored by Leonid Yegoshin's avatar Leonid Yegoshin Committed by Ralf Baechle

MIPS: asm: checksum: Split kernel and user copy operations

In EVA mode, different instructions need to be used to read/write
from kernel and userland. In non-EVA mode, there is no functional
difference. The current address limit is checked to decide the
type of operation that will be performed.
Signed-off-by: default avatarLeonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: default avatarMarkos Chandras <markos.chandras@imgtec.com>
parent 6f85cebe
...@@ -37,7 +37,6 @@ __wsum __csum_partial_copy_from_user(const void *src, void *dst, ...@@ -37,7 +37,6 @@ __wsum __csum_partial_copy_from_user(const void *src, void *dst,
int len, __wsum sum, int *err_ptr); int len, __wsum sum, int *err_ptr);
__wsum __csum_partial_copy_to_user(const void *src, void *dst, __wsum __csum_partial_copy_to_user(const void *src, void *dst,
int len, __wsum sum, int *err_ptr); int len, __wsum sum, int *err_ptr);
/* /*
* this is a new version of the above that records errors it finds in *errp, * this is a new version of the above that records errors it finds in *errp,
* but continues and zeros the rest of the buffer. * but continues and zeros the rest of the buffer.
...@@ -47,6 +46,10 @@ __wsum csum_partial_copy_from_user(const void __user *src, void *dst, int len, ...@@ -47,6 +46,10 @@ __wsum csum_partial_copy_from_user(const void __user *src, void *dst, int len,
__wsum sum, int *err_ptr) __wsum sum, int *err_ptr)
{ {
might_fault(); might_fault();
if (segment_eq(get_fs(), get_ds()))
return __csum_partial_copy_kernel((__force void *)src, dst,
len, sum, err_ptr);
else
return __csum_partial_copy_from_user((__force void *)src, dst, return __csum_partial_copy_from_user((__force void *)src, dst,
len, sum, err_ptr); len, sum, err_ptr);
} }
...@@ -60,9 +63,16 @@ __wsum csum_and_copy_to_user(const void *src, void __user *dst, int len, ...@@ -60,9 +63,16 @@ __wsum csum_and_copy_to_user(const void *src, void __user *dst, int len,
__wsum sum, int *err_ptr) __wsum sum, int *err_ptr)
{ {
might_fault(); might_fault();
if (access_ok(VERIFY_WRITE, dst, len)) if (access_ok(VERIFY_WRITE, dst, len)) {
return __csum_partial_copy_to_user(src, (__force void *)dst, if (segment_eq(get_fs(), get_ds()))
return __csum_partial_copy_kernel(src,
(__force void *)dst,
len, sum, err_ptr);
else
return __csum_partial_copy_to_user(src,
(__force void *)dst,
len, sum, err_ptr); len, sum, err_ptr);
}
if (len) if (len)
*err_ptr = -EFAULT; *err_ptr = -EFAULT;
......
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