diff mbox

[net-next,03/11] tipc: use RTNL lock to protect tipc_net_stop routine

Message ID 1398048952-7825-4-git-send-email-ying.xue@windriver.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Ying Xue April 21, 2014, 2:55 a.m. UTC
As the tipc network initialization(ie, tipc_net_start routine) is
under RTNL protection, its corresponding deinitialization part(ie,
tipc_net_stop routine) should be protected by RTNL too.

Signed-off-by: Ying Xue <ying.xue@windriver.com>
Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Erik Hugne <erik.hugne@ericsson.com>
Tested-by: Erik Hugne <erik.hugne@ericsson.com>
---
 net/tipc/net.c |    2 ++
 1 file changed, 2 insertions(+)
diff mbox

Patch

diff --git a/net/tipc/net.c b/net/tipc/net.c
index 4c564eb..24d2d21 100644
--- a/net/tipc/net.c
+++ b/net/tipc/net.c
@@ -195,11 +195,13 @@  void tipc_net_stop(void)
 		return;
 
 	tipc_nametbl_withdraw(TIPC_CFG_SRV, tipc_own_addr, 0, tipc_own_addr);
+	rtnl_lock();
 	write_lock_bh(&tipc_net_lock);
 	tipc_bearer_stop();
 	tipc_bclink_stop();
 	tipc_node_stop();
 	write_unlock_bh(&tipc_net_lock);
+	rtnl_unlock();
 
 	pr_info("Left network mode\n");
 }