signal: prevent submission of contexts w/o receiver

This prevents a sporadic null-pointer dereference in the nic_loopback
test, which occurred once in 100 runs. I'm not sure if there's still a
race window (we may investigate) with context dissolve.
This commit is contained in:
Christian Helmuth 2016-01-25 15:46:23 +01:00
parent b84a47b4db
commit 2a698ffd5f
1 changed files with 7 additions and 3 deletions

View File

@ -269,9 +269,13 @@ void Signal_receiver::dispatch_signals(Signal_source *signal_source)
continue;
}
/* construct and locally submit signal object */
Signal::Data signal(context, source_signal.num());
context->_receiver->local_submit(signal);
if (context->_receiver) {
/* construct and locally submit signal object */
Signal::Data signal(context, source_signal.num());
context->_receiver->local_submit(signal);
} else {
PWRN("signal context with no receiver");
}
/* free context lock that was taken by 'test_and_lock' */
context->_lock.unlock();