Skip to content

Commit 5256426

Browse files
chleroympe
authored andcommitted
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: 887f3ce ("powerpc/signal32: Convert do_setcontext[_tm]() to user access block") Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/a29aadc54c93bcbf069a83615fa102ca0f59c3ae.1619185912.git.christophe.leroy@csgroup.eu
1 parent f9cd5f9 commit 5256426

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/powerpc/kernel/signal_32.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ static int do_setcontext(struct ucontext __user *ucp, struct pt_regs *regs, int
971971
sigset_t set;
972972
struct mcontext __user *mcp;
973973

974-
if (user_read_access_begin(ucp, sizeof(*ucp)))
974+
if (!user_read_access_begin(ucp, sizeof(*ucp)))
975975
return -EFAULT;
976976

977977
unsafe_get_sigset_t(&set, &ucp->uc_sigmask, failed);
@@ -1009,7 +1009,7 @@ static int do_setcontext_tm(struct ucontext __user *ucp,
10091009
u32 cmcp;
10101010
u32 tm_cmcp;
10111011

1012-
if (user_read_access_begin(ucp, sizeof(*ucp)))
1012+
if (!user_read_access_begin(ucp, sizeof(*ucp)))
10131013
return -EFAULT;
10141014

10151015
unsafe_get_sigset_t(&set, &ucp->uc_sigmask, failed);

0 commit comments

Comments
 (0)