[net-next,12/16] tipc: take lock while updating node network address

Message ID 1334955924-907-13-git-send-email-paul.gortmaker@windriver.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Paul Gortmaker April 20, 2012, 9:05 p.m.
From: Allan Stephens <allan.stephens@windriver.com>

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 |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


diff --git a/net/tipc/net.c b/net/tipc/net.c
index d4531b0..5fab4ff 100644
--- a/net/tipc/net.c
+++ b/net/tipc/net.c
@@ -178,11 +178,12 @@  int tipc_net_start(u32 addr)
+	write_lock_bh(&tipc_net_lock);
 	tipc_own_addr = addr;
+	write_unlock_bh(&tipc_net_lock);
 	tipc_k_signal((Handler)tipc_subscr_start, 0);
 	tipc_k_signal((Handler)tipc_cfg_init, 0);