aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/sit.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 011ecf55d34e..2cb646079237 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1160,7 +1160,7 @@ static int ipip6_tunnel_init(struct net_device *dev)
1160 return 0; 1160 return 0;
1161} 1161}
1162 1162
1163static void __net_init ipip6_fb_tunnel_init(struct net_device *dev) 1163static int __net_init ipip6_fb_tunnel_init(struct net_device *dev)
1164{ 1164{
1165 struct ip_tunnel *tunnel = netdev_priv(dev); 1165 struct ip_tunnel *tunnel = netdev_priv(dev);
1166 struct iphdr *iph = &tunnel->parms.iph; 1166 struct iphdr *iph = &tunnel->parms.iph;
@@ -1175,8 +1175,12 @@ static void __net_init ipip6_fb_tunnel_init(struct net_device *dev)
1175 iph->ihl = 5; 1175 iph->ihl = 5;
1176 iph->ttl = 64; 1176 iph->ttl = 64;
1177 1177
1178 dev->tstats = alloc_percpu(struct pcpu_tstats);
1179 if (!dev->tstats)
1180 return -ENOMEM;
1178 dev_hold(dev); 1181 dev_hold(dev);
1179 sitn->tunnels_wc[0] = tunnel; 1182 sitn->tunnels_wc[0] = tunnel;
1183 return 0;
1180} 1184}
1181 1185
1182static struct xfrm_tunnel sit_handler __read_mostly = { 1186static struct xfrm_tunnel sit_handler __read_mostly = {
@@ -1220,7 +1224,10 @@ static int __net_init sit_init_net(struct net *net)
1220 } 1224 }
1221 dev_net_set(sitn->fb_tunnel_dev, net); 1225 dev_net_set(sitn->fb_tunnel_dev, net);
1222 1226
1223 ipip6_fb_tunnel_init(sitn->fb_tunnel_dev); 1227 err = ipip6_fb_tunnel_init(sitn->fb_tunnel_dev);
1228 if (err)
1229 goto err_dev_free;
1230
1224 ipip6_tunnel_clone_6rd(sitn->fb_tunnel_dev, sitn); 1231 ipip6_tunnel_clone_6rd(sitn->fb_tunnel_dev, sitn);
1225 1232
1226 if ((err = register_netdev(sitn->fb_tunnel_dev))) 1233 if ((err = register_netdev(sitn->fb_tunnel_dev)))
@@ -1230,7 +1237,8 @@ static int __net_init sit_init_net(struct net *net)
1230 1237
1231err_reg_dev: 1238err_reg_dev:
1232 dev_put(sitn->fb_tunnel_dev); 1239 dev_put(sitn->fb_tunnel_dev);
1233 free_netdev(sitn->fb_tunnel_dev); 1240err_dev_free:
1241 ipip6_dev_free(sitn->fb_tunnel_dev);
1234err_alloc_dev: 1242err_alloc_dev:
1235 return err; 1243 return err;
1236} 1244}