Skip to content

Commit

Permalink
avr32: don't mask signals in the error path
Browse files Browse the repository at this point in the history
The current handle_signal() implementation is broken - it will mask
signals if we fail to setup the signal stack frame, which isn't the
desired behaviour, we should only be masking signals if we succeed in
setting up the stack frame.  It looks like this code was copied from the
old (broken) arm implementation but wasn't updated when the arm code was
fixed in commit a6c61e9 ("[ARM] 3168/1: Update ARM signal delivery
and masking").

Cc: Hans-Christian Egtvedt <[email protected]>
Acked-by: Havard Skinnemoen <[email protected]>
Acked-by: Oleg Nesterov <[email protected]>
Signed-off-by: Matt Fleming <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Matt Fleming authored and Al Viro committed May 22, 2012
1 parent 3883e30 commit e1b1fd7
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions arch/avr32/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,22 +238,21 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
*/
ret |= !valid_user_regs(regs);

if (ret != 0) {
force_sigsegv(sig, current);
return;
}

/*
* Block the signal if we were unsuccessful.
* Block the signal if we were successful.
*/
if (ret != 0 || !(ka->sa.sa_flags & SA_NODEFER)) {
spin_lock_irq(&current->sighand->siglock);
sigorsets(&current->blocked, &current->blocked,
&ka->sa.sa_mask);
spin_lock_irq(&current->sighand->siglock);
sigorsets(&current->blocked, &current->blocked,
&ka->sa.sa_mask);
if (!(ka->sa.sa_flags & SA_NODEFER))
sigaddset(&current->blocked, sig);
recalc_sigpending();
spin_unlock_irq(&current->sighand->siglock);
}

if (ret == 0)
return;

force_sigsegv(sig, current);
recalc_sigpending();
spin_unlock_irq(&current->sighand->siglock);
}

/*
Expand Down

0 comments on commit e1b1fd7

Please sign in to comment.