Skip to contentSkip to conversation

avr32: fix handling of blocked signals

PATCH In review Al Viro 1 participant 1 message Dec 15, 2010

lore
Share & tools
lore

Al Viro

author
#0 lore raw

PATCH 3/6 avr32: fix handling of blocked signals

We do _not_ want to block anything on failure to set sigframe up and we do not want to ignore sa_mask even when SA_NODOFER is set.

---
 arch/avr32/kernel/signal.c |   28 +++++++++++-----------------
 1 files changed, 11 insertions(+), 17 deletions(-)
arch/avr32/kernel/signal.c +11 -17
index df7d75c..25090d6 100644
@@ -226,33 +226,27 @@ static inline void
 handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
 	      sigset_t *oldset, struct pt_regs *regs)
 {
-	int ret;
-
 	/*
 	 * Set up the stack frame
 	 */
-	ret = setup_rt_frame(sig, ka, info, oldset, regs);
+	if (setup_rt_frame(sig, ka, info, oldset, regs) != 0)
+		goto fail;
 
 	/*
 	 * Check that the resulting registers are sane
 	 */
-	ret |= !valid_user_regs(regs);
+	if (!valid_user_regs(regs))
+		goto fail;
 
-	/*
-	 * Block the signal if we were unsuccessful.
-	 */
-	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;
+	recalc_sigpending();
+	spin_unlock_irq(&current->sighand->siglock);
+	return;
 
+fail:
 	force_sigsegv(sig, current);
 }
 
Signature · 1 line
1.5.6.5