Skip to content

Commit

Permalink
xtensa: don't mask signals if we fail to setup signal stack
Browse files Browse the repository at this point in the history
setup_frame() needs to return an indication of whether it succeeded or
failed in setting up the signal stack frame.  If setup_frame() fails then
we must not modify current->blocked.

Acked-by: Oleg Nesterov <oleg@redhat.com>
Cc: Chris Zankel <chris@zankel.net>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Matt Fleming authored and Linus Torvalds committed Mar 22, 2012
1 parent ff6d21e commit 3785006
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions arch/xtensa/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ gen_return_code(unsigned char *codemem)
}


static void setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
sigset_t *set, struct pt_regs *regs)
static int setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
sigset_t *set, struct pt_regs *regs)
{
struct rt_sigframe *frame;
int err = 0;
Expand Down Expand Up @@ -422,10 +422,11 @@ static void setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
current->comm, current->pid, signal, frame, regs->pc);
#endif

return;
return 0;

give_sigsegv:
force_sigsegv(sig, current);
return -EFAULT;
}

/*
Expand Down Expand Up @@ -534,7 +535,9 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)

/* Whee! Actually deliver the signal. */
/* Set up the stack frame */
setup_frame(signr, &ka, &info, oldset, regs);
ret = setup_frame(signr, &ka, &info, oldset, regs);
if (ret)
return ret;

spin_lock_irq(&current->sighand->siglock);
sigorsets(&current->blocked, &current->blocked, &ka.sa.sa_mask);
Expand Down

0 comments on commit 3785006

Please sign in to comment.