Skip to content

Commit 32913f3

Browse files
committed
futex: fix user access on powerpc
The powerpc user access code is special, and unlike other architectures distinguishes between user access for reading and writing. And commit 43a43fa ("futex: improve user space accesses") messed that up. It went undetected elsewhere, but caused ppc32 to fail early during boot, because the user access had been started with user_read_access_begin(), but then finished off with just a plain "user_access_end()". Note that the address-masking user access helpers don't even have that read-vs-write distinction, so if powerpc ever wants to do address masking tricks, we'll have to do some extra work for it. [ Make sure to also do it for the EFAULT case, as pointed out by Christophe Leroy ] Reported-by: Andreas Schwab <[email protected]> Cc: Christophe Leroy <[email protected]> Link: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Linus Torvalds <[email protected]>
1 parent fac04ef commit 32913f3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/futex/futex.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,11 @@ static __always_inline int futex_read_inatomic(u32 *dest, u32 __user *from)
265265
else if (!user_read_access_begin(from, sizeof(*from)))
266266
return -EFAULT;
267267
unsafe_get_user(val, from, Efault);
268-
user_access_end();
268+
user_read_access_end();
269269
*dest = val;
270270
return 0;
271271
Efault:
272-
user_access_end();
272+
user_read_access_end();
273273
return -EFAULT;
274274
}
275275

0 commit comments

Comments
 (0)