[PATCH 3/5] powerpc/lib: checksum KHRAP support
Russell Currey
ruscur at russell.cc
Wed Oct 17 17:44:21 AEDT 2018
Wrap the checksumming code in KHRAP locks and unlocks.
Signed-off-by: Russell Currey <ruscur at russell.cc>
---
arch/powerpc/lib/checksum_wrappers.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/lib/checksum_wrappers.c b/arch/powerpc/lib/checksum_wrappers.c
index a0cb63fb76a1..695460a29c9f 100644
--- a/arch/powerpc/lib/checksum_wrappers.c
+++ b/arch/powerpc/lib/checksum_wrappers.c
@@ -26,7 +26,7 @@
__wsum csum_and_copy_from_user(const void __user *src, void *dst,
int len, __wsum sum, int *err_ptr)
{
- unsigned int csum;
+ unsigned int csum, amr = unlock_user_access();
might_sleep();
@@ -60,6 +60,7 @@ __wsum csum_and_copy_from_user(const void __user *src, void *dst,
}
out:
+ lock_user_access(amr);
return (__force __wsum)csum;
}
EXPORT_SYMBOL(csum_and_copy_from_user);
@@ -67,7 +68,7 @@ EXPORT_SYMBOL(csum_and_copy_from_user);
__wsum csum_and_copy_to_user(const void *src, void __user *dst, int len,
__wsum sum, int *err_ptr)
{
- unsigned int csum;
+ unsigned int csum, amr = unlock_user_access();
might_sleep();
@@ -97,6 +98,7 @@ __wsum csum_and_copy_to_user(const void *src, void __user *dst, int len,
}
out:
+ lock_user_access(amr);
return (__force __wsum)csum;
}
EXPORT_SYMBOL(csum_and_copy_to_user);
--
2.19.1
More information about the Linuxppc-dev
mailing list