]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
IPVS netns exit causes crash in conntrack
authorHans Schillstrom <hans.schillstrom@ericsson.com>
Mon, 13 Jun 2011 07:06:57 +0000 (09:06 +0200)
committerSimon Horman <horms@verge.net.au>
Mon, 13 Jun 2011 08:41:47 +0000 (17:41 +0900)
Quote from Patric Mc Hardy
"This looks like nfnetlink.c excited and destroyed the nfnl socket, but
ip_vs was still holding a reference to a conntrack. When the conntrack
got destroyed it created a ctnetlink event, causing an oops in
netlink_has_listeners when trying to use the destroyed nfnetlink
socket."

If nf_conntrack_netlink is loaded before ip_vs this is not a problem.

This patch simply avoids calling ip_vs_conn_drop_conntrack()
when netns is dying as suggested by Julian.

Signed-off-by: Hans Schillstrom <hans.schillstrom@ericsson.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
net/netfilter/ipvs/ip_vs_conn.c
net/netfilter/ipvs/ip_vs_core.c

index bf28ac2fc99b7cf164d82417e6248049787ff923..782db275ac53591eeae96b750f5bbf5cc14b063f 100644 (file)
@@ -776,8 +776,16 @@ static void ip_vs_conn_expire(unsigned long data)
                if (cp->control)
                        ip_vs_control_del(cp);
 
-               if (cp->flags & IP_VS_CONN_F_NFCT)
+               if (cp->flags & IP_VS_CONN_F_NFCT) {
                        ip_vs_conn_drop_conntrack(cp);
+                       /* Do not access conntracks during subsys cleanup
+                        * because nf_conntrack_find_get can not be used after
+                        * conntrack cleanup for the net.
+                        */
+                       smp_rmb();
+                       if (ipvs->enable)
+                               ip_vs_conn_drop_conntrack(cp);
+               }
 
                ip_vs_pe_put(cp->pe);
                kfree(cp->pe_data);
index 55af2242bccd482b8cb762a8f3419cc922724791..24c28d238dcb62f7dc148648a35e8a05b7278fbc 100644 (file)
@@ -1945,6 +1945,7 @@ static void __net_exit __ip_vs_dev_cleanup(struct net *net)
 {
        EnterFunction(2);
        net_ipvs(net)->enable = 0;      /* Disable packet reception */
+       smp_wmb();
        __ip_vs_sync_cleanup(net);
        LeaveFunction(2);
 }