aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-10-30 19:21:28 -0400
committerDavid S. Miller <davem@davemloft.net>2010-10-30 19:21:28 -0400
commit3285ee3bb2e158299ff19b947e41da735980d954 (patch)
tree8235c80ec137fd080e23bdeab8eefa0d9d5c395f /net/ipv4
parent1b803fbfcd1c35857fe52844158213507a8a5bfa (diff)
ip_gre: fix fallback tunnel setup
Before making the fallback tunnel visible to lookups, we should make sure it is completely setup, once ipgre_tunnel_init() had been called and tstats per_cpu pointer allocated. move rcu_assign_pointer(ign->tunnels_wc[0], tunnel); from ipgre_fb_tunnel_init() to ipgre_init_net() Based on a patch from Pavel Emelyanov Reported-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Acked-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/ip_gre.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 01087e035b7d..70ff77f02eee 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -1325,7 +1325,6 @@ static void ipgre_fb_tunnel_init(struct net_device *dev)
1325{ 1325{
1326 struct ip_tunnel *tunnel = netdev_priv(dev); 1326 struct ip_tunnel *tunnel = netdev_priv(dev);
1327 struct iphdr *iph = &tunnel->parms.iph; 1327 struct iphdr *iph = &tunnel->parms.iph;
1328 struct ipgre_net *ign = net_generic(dev_net(dev), ipgre_net_id);
1329 1328
1330 tunnel->dev = dev; 1329 tunnel->dev = dev;
1331 strcpy(tunnel->parms.name, dev->name); 1330 strcpy(tunnel->parms.name, dev->name);
@@ -1336,7 +1335,6 @@ static void ipgre_fb_tunnel_init(struct net_device *dev)
1336 tunnel->hlen = sizeof(struct iphdr) + 4; 1335 tunnel->hlen = sizeof(struct iphdr) + 4;
1337 1336
1338 dev_hold(dev); 1337 dev_hold(dev);
1339 rcu_assign_pointer(ign->tunnels_wc[0], tunnel);
1340} 1338}
1341 1339
1342 1340
@@ -1383,10 +1381,12 @@ static int __net_init ipgre_init_net(struct net *net)
1383 if ((err = register_netdev(ign->fb_tunnel_dev))) 1381 if ((err = register_netdev(ign->fb_tunnel_dev)))
1384 goto err_reg_dev; 1382 goto err_reg_dev;
1385 1383
1384 rcu_assign_pointer(ign->tunnels_wc[0],
1385 netdev_priv(ign->fb_tunnel_dev));
1386 return 0; 1386 return 0;
1387 1387
1388err_reg_dev: 1388err_reg_dev:
1389 free_netdev(ign->fb_tunnel_dev); 1389 ipgre_dev_free(ign->fb_tunnel_dev);
1390err_alloc_dev: 1390err_alloc_dev:
1391 return err; 1391 return err;
1392} 1392}