tipc: protect handler_enabled variable with qitem_lock spin lock
authorYing Xue <ying.xue@windriver.com>
Tue, 10 Dec 2013 06:54:47 +0000 (22:54 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 11 Dec 2013 03:35:49 +0000 (22:35 -0500)
commit1f4de1c895661f76496b9fa30569c86977ff147b
tree68c532b62c7fa0371da9ca50e903f0a1acd15087
parenta5537e6f80ce0040ee320d5e684e73244d901147
tipc: protect handler_enabled variable with qitem_lock spin lock

'handler_enabled' is a global flag indicating whether the TIPC
signal handling service is enabled or not. The lack of lock
protection for this flag incurs a risk for contention, so that
a tipc_k_signal() call might queue a signal handler to a destroyed
signal queue, with unpredictable results. To correct this, we let
the already existing 'qitem_lock' protect the flag, as it already
does with the queue itself. This way, we ensure that the flag
always is consistent across all cores.

Signed-off-by: Ying Xue <ying.xue@windriver.com>
Reviewed-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/handler.c