powerpc/signal32: Fix erroneous SIGSEGV on RT signal return

Return of user_read_access_begin() is tested the wrong way,
leading to a SIGSEGV when the user address is valid and likely
an Oops when the user address is bad.

Fix the test.

Fixes: 887f3ceb51 ("powerpc/signal32: Convert do_setcontext[_tm]() to user access block")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/a29aadc54c93bcbf069a83615fa102ca0f59c3ae.1619185912.git.christophe.leroy@csgroup.eu
This commit is contained in:
Christophe Leroy 2021-04-23 13:52:10 +00:00 committed by Michael Ellerman
parent f9cd5f91a8
commit 5256426247

View file

@ -971,7 +971,7 @@ static int do_setcontext(struct ucontext __user *ucp, struct pt_regs *regs, int
sigset_t set;
struct mcontext __user *mcp;
if (user_read_access_begin(ucp, sizeof(*ucp)))
if (!user_read_access_begin(ucp, sizeof(*ucp)))
return -EFAULT;
unsafe_get_sigset_t(&set, &ucp->uc_sigmask, failed);
@ -1009,7 +1009,7 @@ static int do_setcontext_tm(struct ucontext __user *ucp,
u32 cmcp;
u32 tm_cmcp;
if (user_read_access_begin(ucp, sizeof(*ucp)))
if (!user_read_access_begin(ucp, sizeof(*ucp)))
return -EFAULT;
unsafe_get_sigset_t(&set, &ucp->uc_sigmask, failed);