Skip to content

Commit ecc3624

Browse files
chleroykawasaki
authored andcommitted
lib/strn*,uaccess: Use masked_user_{read/write}_access_begin when required
Properly use masked_user_read_access_begin() and masked_user_write_access_begin() instead of masked_user_access_begin() in order to match user_read_access_end() and user_write_access_end(). This is important for architectures like powerpc that enable separately user reads and user writes. That means masked_user_read_access_begin() is used when user memory is exclusively read during the window and masked_user_write_access_begin() is used when user memory is exclusively writen during the window. masked_user_access_begin() remains and is used when both reads and writes are performed during the open window. Each of them is expected to be terminated by the matching user_read_access_end(), user_write_access_end() and user_access_end(). Signed-off-by: Christophe Leroy <[email protected]>
1 parent a5deccc commit ecc3624

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/strncpy_from_user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ long strncpy_from_user(char *dst, const char __user *src, long count)
126126
if (can_do_masked_user_access()) {
127127
long retval;
128128

129-
src = masked_user_access_begin(src);
129+
src = masked_user_read_access_begin(src);
130130
retval = do_strncpy_from_user(dst, src, count, count);
131131
user_read_access_end();
132132
return retval;

lib/strnlen_user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ long strnlen_user(const char __user *str, long count)
9999
if (can_do_masked_user_access()) {
100100
long retval;
101101

102-
str = masked_user_access_begin(str);
102+
str = masked_user_read_access_begin(str);
103103
retval = do_strnlen_user(str, count, count);
104104
user_read_access_end();
105105
return retval;

0 commit comments

Comments
 (0)