summaryrefslogtreecommitdiff
path: root/arch/mips/include/asm
diff options
context:
space:
mode:
authorThomas Bogendoerfer <tsbogend@alpha.franken.de>2021-04-16 00:21:11 +0300
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>2021-04-16 00:42:21 +0300
commit2c92ef8ff8d327797c1920ae7f938bcc6f3f7421 (patch)
tree0f72d5bb46397d2b3615194beb4e597d673e6839 /arch/mips/include/asm
parent168b84d5d2c07ae6c96ea40a7f420b5b525defa0 (diff)
downloadlinux-2c92ef8ff8d327797c1920ae7f938bcc6f3f7421.tar.xz
MIPS: Fix strnlen_user access check
Commit 04324f44cb69 ("MIPS: Remove get_fs/set_fs") changed the access_ok for strnlen_user to check the whole range, which broke some callers of strndup_user(). Restore the old behaviour and just check the first byte. Fixes: 04324f44cb69 ("MIPS: Remove get_fs/set_fs") Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Diffstat (limited to 'arch/mips/include/asm')
-rw-r--r--arch/mips/include/asm/uaccess.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h
index ab47e597656a..783fecce65c8 100644
--- a/arch/mips/include/asm/uaccess.h
+++ b/arch/mips/include/asm/uaccess.h
@@ -614,8 +614,8 @@ static inline long strnlen_user(const char __user *s, long n)
{
long res;
- if (!access_ok(s, n))
- return -0;
+ if (!access_ok(s, 1))
+ return 0;
might_fault();
__asm__ __volatile__(