powerpc/signal: Move access_ok() out of get_sigframe()

This access_ok() will soon be performed by user_access_begin().
So move it out of get_sigframe().

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/900b93744732ed0887f28f5b6a40730fb04a43fa.1597770847.git.christophe.leroy@csgroup.eu
This commit is contained in:
Christophe Leroy 2020-08-18 17:19:20 +00:00 committed by Michael Ellerman
parent 3fcfb5d1bf
commit 454b1abb58
3 changed files with 3 additions and 7 deletions

View File

@ -154,10 +154,6 @@ void __user *get_sigframe(struct ksignal *ksig, unsigned long sp,
oldsp = sigsp(oldsp, ksig); oldsp = sigsp(oldsp, ksig);
newsp = (oldsp - frame_size) & ~0xFUL; newsp = (oldsp - frame_size) & ~0xFUL;
/* Check access */
if (!access_ok((void __user *)newsp, oldsp - newsp))
return NULL;
return (void __user *)newsp; return (void __user *)newsp;
} }

View File

@ -768,7 +768,7 @@ int handle_rt_signal32(struct ksignal *ksig, sigset_t *oldset,
/* Put a Real Time Context onto stack */ /* Put a Real Time Context onto stack */
rt_sf = get_sigframe(ksig, get_tm_stackpointer(tsk), sizeof(*rt_sf), 1); rt_sf = get_sigframe(ksig, get_tm_stackpointer(tsk), sizeof(*rt_sf), 1);
addr = rt_sf; addr = rt_sf;
if (unlikely(rt_sf == NULL)) if (!access_ok(rt_sf, sizeof(*rt_sf)))
goto badframe; goto badframe;
/* Put the siginfo & fill in most of the ucontext */ /* Put the siginfo & fill in most of the ucontext */
@ -1227,7 +1227,7 @@ int handle_signal32(struct ksignal *ksig, sigset_t *oldset,
/* Set up Signal Frame */ /* Set up Signal Frame */
frame = get_sigframe(ksig, get_tm_stackpointer(tsk), sizeof(*frame), 1); frame = get_sigframe(ksig, get_tm_stackpointer(tsk), sizeof(*frame), 1);
if (unlikely(frame == NULL)) if (!access_ok(frame, sizeof(*frame)))
goto badframe; goto badframe;
sc = (struct sigcontext __user *) &frame->sctx; sc = (struct sigcontext __user *) &frame->sctx;

View File

@ -823,7 +823,7 @@ int handle_rt_signal64(struct ksignal *ksig, sigset_t *set,
#endif #endif
frame = get_sigframe(ksig, get_tm_stackpointer(tsk), sizeof(*frame), 0); frame = get_sigframe(ksig, get_tm_stackpointer(tsk), sizeof(*frame), 0);
if (unlikely(frame == NULL)) if (!access_ok(frame, sizeof(*frame)))
goto badframe; goto badframe;
err |= __put_user(&frame->info, &frame->pinfo); err |= __put_user(&frame->info, &frame->pinfo);