Skip to content

Commit ccecbcc

Browse files
edumazetgregkh
authored andcommitted
ipv6: remove extra dev_hold() for fallback tunnels
commit 0d7a7b2 upstream. My previous commits added a dev_hold() in tunnels ndo_init(), but forgot to remove it from special functions setting up fallback tunnels. Fallback tunnels do call their respective ndo_init() This leads to various reports like : unregister_netdevice: waiting for ip6gre0 to become free. Usage count = 2 Fixes: 48bb569 ("ip6_tunnel: sit: proper dev_{hold|put} in ndo_[un]init methods") Fixes: 6289a98 ("sit: proper dev_{hold|put} in ndo_[un]init methods") Fixes: 40cb881 ("ip6_vti: proper dev_{hold|put} in ndo_[un]init methods") Fixes: 7f70033 ("ip6_gre: proper dev_{hold|put} in ndo_[un]init methods") Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: syzbot <syzkaller@googlegroups.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 019c426 commit ccecbcc

4 files changed

Lines changed: 0 additions & 6 deletions

File tree

‎net/ipv6/ip6_gre.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,6 @@ static struct ip6_tnl *ip6gre_tunnel_locate(struct net *net,
387387
if (!(nt->parms.o_flags & TUNNEL_SEQ))
388388
dev->features |= NETIF_F_LLTX;
389389

390-
dev_hold(dev);
391390
ip6gre_tunnel_link(ign, nt);
392391
return nt;
393392

@@ -1539,8 +1538,6 @@ static void ip6gre_fb_tunnel_init(struct net_device *dev)
15391538
strcpy(tunnel->parms.name, dev->name);
15401539

15411540
tunnel->hlen = sizeof(struct ipv6hdr) + 4;
1542-
1543-
dev_hold(dev);
15441541
}
15451542

15461543
static struct inet6_protocol ip6gre_protocol __read_mostly = {

‎net/ipv6/ip6_tunnel.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1956,7 +1956,6 @@ static int __net_init ip6_fb_tnl_dev_init(struct net_device *dev)
19561956
struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);
19571957

19581958
t->parms.proto = IPPROTO_IPV6;
1959-
dev_hold(dev);
19601959

19611960
rcu_assign_pointer(ip6n->tnls_wc[0], t);
19621961
return 0;

‎net/ipv6/ip6_vti.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,6 @@ static int __net_init vti6_fb_tnl_dev_init(struct net_device *dev)
962962
struct vti6_net *ip6n = net_generic(net, vti6_net_id);
963963

964964
t->parms.proto = IPPROTO_IPV6;
965-
dev_hold(dev);
966965

967966
rcu_assign_pointer(ip6n->tnls_wc[0], t);
968967
return 0;

‎net/ipv6/sit.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,6 @@ static void __net_init ipip6_fb_tunnel_init(struct net_device *dev)
14701470
iph->ihl = 5;
14711471
iph->ttl = 64;
14721472

1473-
dev_hold(dev);
14741473
rcu_assign_pointer(sitn->tunnels_wc[0], tunnel);
14751474
}
14761475

0 commit comments

Comments
 (0)