netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND net] ipv4: take rtnl_lock and mark mrt table as freed on namespace cleanup
@ 2015-03-31 18:01 Cong Wang
  2015-03-31 18:01 ` [Patch net] net: move fib_rules_unregister() under rtnl lock Cong Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Cong Wang @ 2015-03-31 18:01 UTC (permalink / raw)
  To: netdev; +Cc: Cong Wang, Hannes Frederic Sowa

This is the IPv4 part for commit 905a6f96a1b1
(ipv6: take rtnl_lock and mark mrt6 table as freed on namespace cleanup).

Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
 net/ipv4/ipmr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 9282544..bc40115 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -278,10 +278,12 @@ static void __net_exit ipmr_rules_exit(struct net *net)
 {
 	struct mr_table *mrt, *next;
 
+	rtnl_lock();
 	list_for_each_entry_safe(mrt, next, &net->ipv4.mr_tables, list) {
 		list_del(&mrt->list);
 		ipmr_free_table(mrt);
 	}
+	rtnl_unlock();
 	fib_rules_unregister(net->ipv4.mr_rules_ops);
 }
 #else
@@ -308,7 +310,10 @@ static int __net_init ipmr_rules_init(struct net *net)
 
 static void __net_exit ipmr_rules_exit(struct net *net)
 {
+	rtnl_lock();
 	ipmr_free_table(net->ipv4.mrt);
+	net->ipv4.mrt = NULL;
+	rtnl_unlock();
 }
 #endif
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-04-03  0:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-31 18:01 [PATCH RESEND net] ipv4: take rtnl_lock and mark mrt table as freed on namespace cleanup Cong Wang
2015-03-31 18:01 ` [Patch net] net: move fib_rules_unregister() under rtnl lock Cong Wang
2015-04-03  0:53   ` David Miller
2015-03-31 18:01 ` [Patch net] ip6mr: call del_timer_sync() in ip6mr_free_table() Cong Wang
2015-04-03  0:53   ` David Miller
2015-04-03  0:53 ` [PATCH RESEND net] ipv4: take rtnl_lock and mark mrt table as freed on namespace cleanup David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).