tipc: take lock while updating node network address
authorAllan Stephens <allan.stephens@windriver.com>
Wed, 18 Apr 2012 13:12:09 +0000 (09:12 -0400)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Thu, 19 Apr 2012 19:46:46 +0000 (15:46 -0400)
The routine that changes the node's network address now takes TIPC's
network lock in write mode while the main address variable and associated
data structures are being changed; this is needed to ensure that the
link subsystem won't attempt to send a message off-node until the sending
port's message header template has been updated with the node's new
network address.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
net/tipc/net.c

index d4531b07076cc933cc646cbbf15adfc7c728cf67..5fab4ff24a946b2360ab0d750b198b1f8f96448a 100644 (file)
@@ -178,11 +178,12 @@ int tipc_net_start(u32 addr)
        tipc_subscr_stop();
        tipc_cfg_stop();
 
+       write_lock_bh(&tipc_net_lock);
        tipc_own_addr = addr;
        tipc_named_reinit();
        tipc_port_reinit();
-
        tipc_bclink_init();
+       write_unlock_bh(&tipc_net_lock);
 
        tipc_k_signal((Handler)tipc_subscr_start, 0);
        tipc_k_signal((Handler)tipc_cfg_init, 0);