[Devel] [PATCH RHEL7 COMMIT] ms/ipv4: take rtnl_lock and mark mrt table as freed on namespace cleanup

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jul 17 13:19:42 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.25
------>
commit 30ffed5936fb2eb9cb9870fcf7b6fcdf7d8a8b3a
Author: Vasily Averin <vvs at virtuozzo.com>
Date:   Sat Jul 18 00:19:42 2015 +0400

    ms/ipv4: take rtnl_lock and mark mrt table as freed on namespace cleanup
    
    mainline commit ed785309c9
    
        ipv4: take rtnl_lock and mark mrt table as freed on namespace cleanup
    
        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 at stressinduktion.org>
        Acked-by: Hannes Frederic Sowa <hannes at stressinduktion.org>
        Signed-off-by: Cong Wang <xiyou.wangcong at gmail.com>
        Signed-off-by: David S. Miller <davem at davemloft.net>
    
    Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
 net/ipv4/ipmr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index b26fbb4..68db4a8 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -275,10 +275,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
@@ -305,7 +307,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
 



More information about the Devel mailing list