diff options
author | Christophe Leroy <christophe.leroy@c-s.fr> | 2020-04-03 07:20:51 +0000 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2020-05-01 12:35:21 +1000 |
commit | 41cd780524674082b037e7c8461f90c5e42103f0 (patch) | |
tree | eb705efdf71be777efedd2cd76e1f47d7cd753e2 /lib/usercopy.c | |
parent | 999a22890cb183b918e4372395d24426a755cef2 (diff) | |
download | linux-41cd780524674082b037e7c8461f90c5e42103f0.tar.bz2 |
uaccess: Selectively open read or write user access
When opening user access to only perform reads, only open read access.
When opening user access to only perform writes, only open write
access.
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/2e73bc57125c2c6ab12a587586a4eed3a47105fc.1585898438.git.christophe.leroy@c-s.fr
Diffstat (limited to 'lib/usercopy.c')
-rw-r--r-- | lib/usercopy.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/usercopy.c b/lib/usercopy.c index cbb4d9ec00f2..ca2a697a2061 100644 --- a/lib/usercopy.c +++ b/lib/usercopy.c @@ -58,7 +58,7 @@ int check_zeroed_user(const void __user *from, size_t size) from -= align; size += align; - if (!user_access_begin(from, size)) + if (!user_read_access_begin(from, size)) return -EFAULT; unsafe_get_user(val, (unsigned long __user *) from, err_fault); @@ -79,10 +79,10 @@ int check_zeroed_user(const void __user *from, size_t size) val &= aligned_byte_mask(size); done: - user_access_end(); + user_read_access_end(); return (val == 0); err_fault: - user_access_end(); + user_read_access_end(); return -EFAULT; } EXPORT_SYMBOL(check_zeroed_user); |