From 08baf2fcc35d79f0ff4232af636ce595255c8a58 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 30 Sep 2015 11:00:33 -0600 Subject: [PATCH] ARMv7-M: Fix logic that determines if there is a pending signal action before scheduling the next signal action. Both the test and the scheduling action need to be atomic --- arch/arm/src/armv7-m/up_schedulesigaction.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/arch/arm/src/armv7-m/up_schedulesigaction.c b/arch/arm/src/armv7-m/up_schedulesigaction.c index d61420a73dc..1b5cc41db7d 100644 --- a/arch/arm/src/armv7-m/up_schedulesigaction.c +++ b/arch/arm/src/armv7-m/up_schedulesigaction.c @@ -104,18 +104,19 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) { - /* Refuse to handle nested signal actions */ + irqstate_t flags; sdbg("tcb=0x%p sigdeliver=0x%p\n", tcb, sigdeliver); + DEBUGASSERT(tcb != NULL && sigdeliver != NULL); - if (!tcb->xcp.sigdeliver) + /* Make sure that interrupts are disabled */ + + flags = irqsave(); + + /* Refuse to handle nested signal actions */ + + if (tcb->xcp.sigdeliver == NULL) { - irqstate_t flags; - - /* Make sure that interrupts are disabled */ - - flags = irqsave(); - /* First, handle some special cases when the signal is being delivered * to the currently executing task. */ @@ -222,9 +223,9 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) tcb->xcp.regs[REG_LR] = EXC_RETURN_PRIVTHR; #endif } - - irqrestore(flags); } + + irqrestore(flags); } #endif /* !CONFIG_DISABLE_SIGNALS */