From: Matt Fleming Date: Fri, 11 May 2012 00:57:57 +0000 (+1000) Subject: avr32: don't mask signals in the error path X-Git-Tag: firefly_0821_release~3680^2~2783^2~38 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e1b1fd79a04396d5ec971e9e4d4711b5a58ad7e3;p=firefly-linux-kernel-4.4.55.git avr32: don't mask signals in the error path 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 a6c61e9dfdd0 ("[ARM] 3168/1: Update ARM signal delivery and masking"). Cc: Hans-Christian Egtvedt Acked-by: Havard Skinnemoen Acked-by: Oleg Nesterov Signed-off-by: Matt Fleming Signed-off-by: Andrew Morton Signed-off-by: Al Viro --- diff --git a/arch/avr32/kernel/signal.c b/arch/avr32/kernel/signal.c index 64f886fac2ef..9c075e105d60 100644 --- a/arch/avr32/kernel/signal.c +++ b/arch/avr32/kernel/signal.c @@ -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(¤t->sighand->siglock); - sigorsets(¤t->blocked, ¤t->blocked, - &ka->sa.sa_mask); + spin_lock_irq(¤t->sighand->siglock); + sigorsets(¤t->blocked, ¤t->blocked, + &ka->sa.sa_mask); + if (!(ka->sa.sa_flags & SA_NODEFER)) sigaddset(¤t->blocked, sig); - recalc_sigpending(); - spin_unlock_irq(¤t->sighand->siglock); - } - - if (ret == 0) - return; - - force_sigsegv(sig, current); + recalc_sigpending(); + spin_unlock_irq(¤t->sighand->siglock); } /*