m68knommu: Don't lose state if sigframe setup fails
exact parallel to m68k analog Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Acked-by: Greg Ungerer <gerg@uclinux.org> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
This commit is contained in:
parent
d1574df7e0
commit
089e449a82
|
@ -528,7 +528,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
|
||||||
return (void *)((usp - frame_size) & -8UL);
|
return (void *)((usp - frame_size) & -8UL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setup_frame (int sig, struct k_sigaction *ka,
|
static int setup_frame (int sig, struct k_sigaction *ka,
|
||||||
sigset_t *set, struct pt_regs *regs)
|
sigset_t *set, struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
struct sigframe *frame;
|
struct sigframe *frame;
|
||||||
|
@ -582,14 +582,14 @@ adjust_stack:
|
||||||
tregs->pc = regs->pc;
|
tregs->pc = regs->pc;
|
||||||
tregs->sr = regs->sr;
|
tregs->sr = regs->sr;
|
||||||
}
|
}
|
||||||
return;
|
return err;
|
||||||
|
|
||||||
give_sigsegv:
|
give_sigsegv:
|
||||||
force_sigsegv(sig, current);
|
force_sigsegv(sig, current);
|
||||||
goto adjust_stack;
|
goto adjust_stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
|
static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
|
||||||
sigset_t *set, struct pt_regs *regs)
|
sigset_t *set, struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
struct rt_sigframe *frame;
|
struct rt_sigframe *frame;
|
||||||
|
@ -646,7 +646,7 @@ adjust_stack:
|
||||||
tregs->pc = regs->pc;
|
tregs->pc = regs->pc;
|
||||||
tregs->sr = regs->sr;
|
tregs->sr = regs->sr;
|
||||||
}
|
}
|
||||||
return;
|
return err;
|
||||||
|
|
||||||
give_sigsegv:
|
give_sigsegv:
|
||||||
force_sigsegv(sig, current);
|
force_sigsegv(sig, current);
|
||||||
|
@ -693,6 +693,7 @@ static void
|
||||||
handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info,
|
handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info,
|
||||||
sigset_t *oldset, struct pt_regs *regs)
|
sigset_t *oldset, struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
|
int err;
|
||||||
/* are we from a system call? */
|
/* are we from a system call? */
|
||||||
if (regs->orig_d0 >= 0)
|
if (regs->orig_d0 >= 0)
|
||||||
/* If so, check system call restarting.. */
|
/* If so, check system call restarting.. */
|
||||||
|
@ -700,9 +701,12 @@ handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info,
|
||||||
|
|
||||||
/* set up the stack frame */
|
/* set up the stack frame */
|
||||||
if (ka->sa.sa_flags & SA_SIGINFO)
|
if (ka->sa.sa_flags & SA_SIGINFO)
|
||||||
setup_rt_frame(sig, ka, info, oldset, regs);
|
err = setup_rt_frame(sig, ka, info, oldset, regs);
|
||||||
else
|
else
|
||||||
setup_frame(sig, ka, oldset, regs);
|
err = setup_frame(sig, ka, oldset, regs);
|
||||||
|
|
||||||
|
if (err)
|
||||||
|
return;
|
||||||
|
|
||||||
spin_lock_irq(¤t->sighand->siglock);
|
spin_lock_irq(¤t->sighand->siglock);
|
||||||
sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask);
|
sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask);
|
||||||
|
@ -710,6 +714,8 @@ handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info,
|
||||||
sigaddset(¤t->blocked,sig);
|
sigaddset(¤t->blocked,sig);
|
||||||
recalc_sigpending();
|
recalc_sigpending();
|
||||||
spin_unlock_irq(¤t->sighand->siglock);
|
spin_unlock_irq(¤t->sighand->siglock);
|
||||||
|
|
||||||
|
clear_thread_flag(TIF_RESTORE_SIGMASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -742,7 +748,6 @@ asmlinkage void do_signal(struct pt_regs *regs)
|
||||||
if (signr > 0) {
|
if (signr > 0) {
|
||||||
/* Whee! Actually deliver the signal. */
|
/* Whee! Actually deliver the signal. */
|
||||||
handle_signal(signr, &ka, &info, oldset, regs);
|
handle_signal(signr, &ka, &info, oldset, regs);
|
||||||
clear_thread_flag(TIF_RESTORE_SIGMASK);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue