aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/ip6_tunnel.c15
-rw-r--r--net/ipv6/sit.c13
2 files changed, 20 insertions, 8 deletions
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 2a124e9a1b2d..78f438880923 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -238,17 +238,24 @@ static struct ip6_tnl *ip6_tnl_create(struct ip6_tnl_parm *p)
238 if (dev == NULL) 238 if (dev == NULL)
239 goto failed; 239 goto failed;
240 240
241 if (strchr(name, '%')) {
242 if (dev_alloc_name(dev, name) < 0)
243 goto failed_free;
244 }
245
241 t = netdev_priv(dev); 246 t = netdev_priv(dev);
242 dev->init = ip6_tnl_dev_init; 247 dev->init = ip6_tnl_dev_init;
243 t->parms = *p; 248 t->parms = *p;
244 249
245 if ((err = register_netdevice(dev)) < 0) { 250 if ((err = register_netdevice(dev)) < 0)
246 free_netdev(dev); 251 goto failed_free;
247 goto failed; 252
248 }
249 dev_hold(dev); 253 dev_hold(dev);
250 ip6_tnl_link(t); 254 ip6_tnl_link(t);
251 return t; 255 return t;
256
257failed_free:
258 free_netdev(dev);
252failed: 259failed:
253 return NULL; 260 return NULL;
254} 261}
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index dde7801abeff..1656c003b989 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -171,6 +171,11 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, int
171 if (dev == NULL) 171 if (dev == NULL)
172 return NULL; 172 return NULL;
173 173
174 if (strchr(name, '%')) {
175 if (dev_alloc_name(dev, name) < 0)
176 goto failed_free;
177 }
178
174 nt = netdev_priv(dev); 179 nt = netdev_priv(dev);
175 dev->init = ipip6_tunnel_init; 180 dev->init = ipip6_tunnel_init;
176 nt->parms = *parms; 181 nt->parms = *parms;
@@ -178,16 +183,16 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, int
178 if (parms->i_flags & SIT_ISATAP) 183 if (parms->i_flags & SIT_ISATAP)
179 dev->priv_flags |= IFF_ISATAP; 184 dev->priv_flags |= IFF_ISATAP;
180 185
181 if (register_netdevice(dev) < 0) { 186 if (register_netdevice(dev) < 0)
182 free_netdev(dev); 187 goto failed_free;
183 goto failed;
184 }
185 188
186 dev_hold(dev); 189 dev_hold(dev);
187 190
188 ipip6_tunnel_link(nt); 191 ipip6_tunnel_link(nt);
189 return nt; 192 return nt;
190 193
194failed_free:
195 free_netdev(dev);
191failed: 196failed:
192 return NULL; 197 return NULL;
193} 198}