diff options
author | Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> | 2008-09-12 20:01:09 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-09-14 09:35:34 -0400 |
commit | 3d0aedd9538e6be8afec1a9d8b084bf90bc91495 (patch) | |
tree | f1dd505b2a703343a0c5dc0ab3a7c2e98949f1f8 /arch/x86/kernel/signal_64.c | |
parent | 764e8d128f9343027cf09afe8a145e8ff186e129 (diff) |
x86: signal: put give_sigsegv of setup frames together
When setup frame fails, force_sigsegv is called and returns -EFAULT.
There is similar code in ia32_setup_frame(), ia32_setup_rt_frame(),
__setup_frame() and __setup_rt_frame().
Make them identical.
No change in functionality intended.
Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/signal_64.c')
-rw-r--r-- | arch/x86/kernel/signal_64.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c index 43e6862fc7a2..3b79e179ba3a 100644 --- a/arch/x86/kernel/signal_64.c +++ b/arch/x86/kernel/signal_64.c | |||
@@ -215,12 +215,12 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
215 | frame = get_stack(ka, regs, sizeof(struct rt_sigframe)) - 8; | 215 | frame = get_stack(ka, regs, sizeof(struct rt_sigframe)) - 8; |
216 | 216 | ||
217 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 217 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
218 | goto give_sigsegv; | 218 | return -EFAULT; |
219 | 219 | ||
220 | if (ka->sa.sa_flags & SA_SIGINFO) { | 220 | if (ka->sa.sa_flags & SA_SIGINFO) { |
221 | err |= copy_siginfo_to_user(&frame->info, info); | 221 | err |= copy_siginfo_to_user(&frame->info, info); |
222 | if (err) | 222 | if (err) |
223 | goto give_sigsegv; | 223 | return -EFAULT; |
224 | } | 224 | } |
225 | 225 | ||
226 | /* Create the ucontext. */ | 226 | /* Create the ucontext. */ |
@@ -248,11 +248,11 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
248 | err |= __put_user(ka->sa.sa_restorer, &frame->pretcode); | 248 | err |= __put_user(ka->sa.sa_restorer, &frame->pretcode); |
249 | } else { | 249 | } else { |
250 | /* could use a vstub here */ | 250 | /* could use a vstub here */ |
251 | goto give_sigsegv; | 251 | return -EFAULT; |
252 | } | 252 | } |
253 | 253 | ||
254 | if (err) | 254 | if (err) |
255 | goto give_sigsegv; | 255 | return -EFAULT; |
256 | 256 | ||
257 | /* Set up registers for signal handler */ | 257 | /* Set up registers for signal handler */ |
258 | regs->di = sig; | 258 | regs->di = sig; |
@@ -272,10 +272,6 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
272 | regs->cs = __USER_CS; | 272 | regs->cs = __USER_CS; |
273 | 273 | ||
274 | return 0; | 274 | return 0; |
275 | |||
276 | give_sigsegv: | ||
277 | force_sigsegv(sig, current); | ||
278 | return -EFAULT; | ||
279 | } | 275 | } |
280 | 276 | ||
281 | /* | 277 | /* |
@@ -297,6 +293,11 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
297 | #endif | 293 | #endif |
298 | ret = __setup_rt_frame(sig, ka, info, set, regs); | 294 | ret = __setup_rt_frame(sig, ka, info, set, regs); |
299 | 295 | ||
296 | if (ret) { | ||
297 | force_sigsegv(sig, current); | ||
298 | return -EFAULT; | ||
299 | } | ||
300 | |||
300 | return ret; | 301 | return ret; |
301 | } | 302 | } |
302 | 303 | ||