mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
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
This commit is contained in:
committed by
Michael Ellerman
parent
999a22890c
commit
41cd780524
@@ -116,9 +116,9 @@ long strncpy_from_user(char *dst, const char __user *src, long count)
|
||||
|
||||
kasan_check_write(dst, count);
|
||||
check_object_size(dst, count, false);
|
||||
if (user_access_begin(src, max)) {
|
||||
if (user_read_access_begin(src, max)) {
|
||||
retval = do_strncpy_from_user(dst, src, count, max);
|
||||
user_access_end();
|
||||
user_read_access_end();
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user