netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: [PATCH net-next] sit: proper dev_{hold|put} in ndo_[un]init methods
@ 2021-03-31  0:05 Wong, Vee Khee
  2021-03-31  5:53 ` Eric Dumazet
  0 siblings, 1 reply; 8+ messages in thread
From: Wong, Vee Khee @ 2021-03-31  0:05 UTC (permalink / raw)
  To: eric.dumazet
  Cc: davem, edumazet, kuba, netdev, syzkaller, Ismail, Mohammad Athari

Hi all,

This patch introduced the following massive warnings printouts on a
Intel x86 Alderlake platform with STMMAC MAC and Marvell 88E2110 PHY.

[  149.674232] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
[  159.930310] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
[  170.186205] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
[  180.434311] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
[  190.682309] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
[  200.690176] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
[  210.938310] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
[  221.186311] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
[  231.442311] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
[  241.690186] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
[  251.698288] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
[  261.946311] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
[  272.194181] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
[  282.442311] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
[  292.690310] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
[  302.938313] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
[  313.186255] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
[  323.442329] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
[  333.698309] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
[  343.946310] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
[  354.202166] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
[  364.450190] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
[  374.706314] unregister_netdevice: waiting for sit0 to become free. Usage count = 2

Is this an expected behavior?

Thanks,
VK

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next] sit: proper dev_{hold|put} in ndo_[un]init methods
  2021-03-31  0:05 [PATCH net-next] sit: proper dev_{hold|put} in ndo_[un]init methods Wong, Vee Khee
@ 2021-03-31  5:53 ` Eric Dumazet
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Dumazet @ 2021-03-31  5:53 UTC (permalink / raw)
  To: Wong, Vee Khee
  Cc: eric.dumazet, davem, kuba, netdev, syzkaller, Ismail, Mohammad Athari

[-- Attachment #1: Type: text/plain, Size: 2566 bytes --]

On Wed, Mar 31, 2021 at 2:05 AM Wong, Vee Khee <vee.khee.wong@intel.com> wrote:
>
> Hi all,
>
> This patch introduced the following massive warnings printouts on a
> Intel x86 Alderlake platform with STMMAC MAC and Marvell 88E2110 PHY.
>
> [  149.674232] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> [  159.930310] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> [  170.186205] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> [  180.434311] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> [  190.682309] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> [  200.690176] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> [  210.938310] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> [  221.186311] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> [  231.442311] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> [  241.690186] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> [  251.698288] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> [  261.946311] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> [  272.194181] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> [  282.442311] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> [  292.690310] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> [  302.938313] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> [  313.186255] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> [  323.442329] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> [  333.698309] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> [  343.946310] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> [  354.202166] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> [  364.450190] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> [  374.706314] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> Is this an expected behavior?
>


Nope, I already have a fix, but it depends on a pending patch.

https://patchwork.kernel.org/project/netdevbpf/patch/20210330064551.545964-1-eric.dumazet@gmail.com/

(I need the patch being merged to add a corresponding Fixes: tag)

You can try the attached patch :

[-- Attachment #2: 0001-ipv6-remove-extra-dev_hold-for-fallback-tunnels.patch --]
[-- Type: text/x-patch, Size: 3126 bytes --]

From 2c9cce067a9a1aec32b323ef80179b1856c796af Mon Sep 17 00:00:00 2001
From: Eric Dumazet <edumazet@google.com>
Date: Tue, 30 Mar 2021 13:29:08 -0700
Subject: [PATCH net-next] ipv6: remove extra dev_hold() for fallback tunnels

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: f21eb0195662 ("ip6_tunnel: sit: proper dev_{hold|put} in ndo_[un]init methods")
Fixes: 6289a98f0817 ("sit: proper dev_{hold|put} in ndo_[un]init methods")
Fixes: 40cb881b5aaa ("ip6_vti: proper dev_{hold|put} in ndo_[un]init methods")
Fixes: 7f700334be9a ("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>
---
 net/ipv6/ip6_gre.c    | 3 ---
 net/ipv6/ip6_tunnel.c | 1 -
 net/ipv6/ip6_vti.c    | 1 -
 net/ipv6/sit.c        | 1 -
 4 files changed, 6 deletions(-)

diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 9689bf9f46f347562330a4d8630c0b0b13a411fc..bc224f917bbd53beb9b8af5bdef3fb9794b8ee44 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -387,7 +387,6 @@ static struct ip6_tnl *ip6gre_tunnel_locate(struct net *net,
 	if (!(nt->parms.o_flags & TUNNEL_SEQ))
 		dev->features |= NETIF_F_LLTX;
 
-	dev_hold(dev);
 	ip6gre_tunnel_link(ign, nt);
 	return nt;
 
@@ -1539,8 +1538,6 @@ static void ip6gre_fb_tunnel_init(struct net_device *dev)
 	strcpy(tunnel->parms.name, dev->name);
 
 	tunnel->hlen		= sizeof(struct ipv6hdr) + 4;
-
-	dev_hold(dev);
 }
 
 static struct inet6_protocol ip6gre_protocol __read_mostly = {
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 67ee9d58ec5efcc81e8b27406bd4f57a0caea70b..07a0a06a9b52bc9974e2f36b1477c341c952f94a 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1925,7 +1925,6 @@ static int __net_init ip6_fb_tnl_dev_init(struct net_device *dev)
 	struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);
 
 	t->parms.proto = IPPROTO_IPV6;
-	dev_hold(dev);
 
 	rcu_assign_pointer(ip6n->tnls_wc[0], t);
 	return 0;
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index a018afdb3e062c9e664d4ca424176a859f0a332c..856e46ad0895b47b58896852afee3d4a398b139e 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -963,7 +963,6 @@ static int __net_init vti6_fb_tnl_dev_init(struct net_device *dev)
 	struct vti6_net *ip6n = net_generic(net, vti6_net_id);
 
 	t->parms.proto = IPPROTO_IPV6;
-	dev_hold(dev);
 
 	rcu_assign_pointer(ip6n->tnls_wc[0], t);
 	return 0;
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 488d3181aec3a5558dbefb6145400627535df761..ff2ca2e7c7f5045663069ea572560d58abee2970 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1470,7 +1470,6 @@ static void __net_init ipip6_fb_tunnel_init(struct net_device *dev)
 	iph->ihl		= 5;
 	iph->ttl		= 64;
 
-	dev_hold(dev);
 	rcu_assign_pointer(sitn->tunnels_wc[0], tunnel);
 }
 
-- 
2.31.0.291.g576ba9dcdaf-goog


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next] sit: proper dev_{hold|put} in ndo_[un]init methods
  2021-03-31  5:58 ` Eric Dumazet
  2021-03-31  8:51   ` Wong, Vee Khee
@ 2021-08-16 15:13   ` Alarig Le Lay
  1 sibling, 0 replies; 8+ messages in thread
From: Alarig Le Lay @ 2021-08-16 15:13 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Wong, Vee Khee, eric.dumazet, davem, kuba, netdev, syzkaller,
	Ismail, Mohammad Athari

Hi,

On Wed 31 Mar 2021 07:58:07 GMT, Eric Dumazet wrote:
> On Wed, Mar 31, 2021 at 2:01 AM Wong, Vee Khee <vee.khee.wong@intel.com> wrote:
> >
> > Hi all,
> >
> >
> >
> > This patch introduced the following massive warnings printouts on a
> >
> > Intel x86 Alderlake platform with STMMAC MAC and Marvell 88E2110 PHY.
> >
> >
> >
> > [  149.674232] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
> 
> Same answer than the other thread :
> 
> Nope, I already have a fix, but it depends on a pending patch.
> 
> https://patchwork.kernel.org/project/netdevbpf/patch/20210330064551.545964-1-eric.dumazet@gmail.com/
> 
> (I need the patch being merged to add a corresponding Fixes: tag)
> 
> You can try the attached patch :

I’ve upgraded some boxes to 4.14.240 which includes the fix, but I have
> unregister_netdevice: waiting for ip6gre0 to become free. Usage count = -1 
every ten seconds.

It’s not the same interface name nor the same count, so perhaps there is
another issue with the patches?

Regards,
-- 
Alarig Le Lay

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next] sit: proper dev_{hold|put} in ndo_[un]init methods
  2021-03-31  8:51   ` Wong, Vee Khee
@ 2021-03-31  9:02     ` Eric Dumazet
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Dumazet @ 2021-03-31  9:02 UTC (permalink / raw)
  To: Wong, Vee Khee
  Cc: eric.dumazet, davem, kuba, netdev, syzkaller, Ismail, Mohammad Athari

On Wed, Mar 31, 2021 at 10:52 AM Wong, Vee Khee <vee.khee.wong@intel.com> wrote:
>
> On Wed, Mar 31, 2021 at 13:58, Eric Dumazet wrote:
> >

> >
> > Nope, I already have a fix, but it depends on a pending patch.
> >
> > https://patchwork.kernel.org/project/netdevbpf/patch/20210330064551.54
> > 5964-1-eric.dumazet@gmail.com/
> >
> > (I need the patch being merged to add a corresponding Fixes: tag)
> >
> > You can try the attached patch :
>
> Thanks, I applied the two patches you mentioned and
> no longer seeing the warnings.
>

Thanks for testing !

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH net-next] sit: proper dev_{hold|put} in ndo_[un]init methods
  2021-03-31  5:58 ` Eric Dumazet
@ 2021-03-31  8:51   ` Wong, Vee Khee
  2021-03-31  9:02     ` Eric Dumazet
  2021-08-16 15:13   ` Alarig Le Lay
  1 sibling, 1 reply; 8+ messages in thread
From: Wong, Vee Khee @ 2021-03-31  8:51 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: eric.dumazet, davem, kuba, netdev, syzkaller, Ismail, Mohammad Athari

On Wed, Mar 31, 2021 at 13:58, Eric Dumazet wrote:
> 
> On Wed, Mar 31, 2021 at 2:01 AM Wong, Vee Khee
> <vee.khee.wong@intel.com> wrote:
> >
> > Hi all,
> >
> >
> >
> > This patch introduced the following massive warnings printouts on a
> >
> > Intel x86 Alderlake platform with STMMAC MAC and Marvell 88E2110 PHY.
> >
> >
> >
> > [  149.674232] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> > [  159.930310] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> > [  170.186205] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> > [  180.434311] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> > [  190.682309] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> > [  200.690176] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> > [  210.938310] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> > [  221.186311] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> > [  231.442311] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> > [  241.690186] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> > [  251.698288] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> > [  261.946311] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> > [  272.194181] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> > [  282.442311] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> > [  292.690310] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> > [  302.938313] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> > [  313.186255] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> > [  323.442329] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> > [  333.698309] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> > [  343.946310] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> > [  354.202166] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> > [  364.450190] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> > [  374.706314] unregister_netdevice: waiting for sit0 to become free.
> Usage count = 2
> >
> >
> >
> > Is this an expected behavior?
> >
> >
> >
> > Thanks,
> >
> > VK
> 
> Same answer than the other thread :
> 
> Nope, I already have a fix, but it depends on a pending patch.
> 
> https://patchwork.kernel.org/project/netdevbpf/patch/20210330064551.54
> 5964-1-eric.dumazet@gmail.com/
> 
> (I need the patch being merged to add a corresponding Fixes: tag)
> 
> You can try the attached patch :

Thanks, I applied the two patches you mentioned and
no longer seeing the warnings.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next] sit: proper dev_{hold|put} in ndo_[un]init methods
       [not found] <BYAPR11MB2870B0910C71BDDFD328B339AB7C9@BYAPR11MB2870.namprd11.prod.outlook.com>
@ 2021-03-31  5:58 ` Eric Dumazet
  2021-03-31  8:51   ` Wong, Vee Khee
  2021-08-16 15:13   ` Alarig Le Lay
  0 siblings, 2 replies; 8+ messages in thread
From: Eric Dumazet @ 2021-03-31  5:58 UTC (permalink / raw)
  To: Wong, Vee Khee
  Cc: eric.dumazet, davem, kuba, netdev, syzkaller, Ismail, Mohammad Athari

[-- Attachment #1: Type: text/plain, Size: 2681 bytes --]

On Wed, Mar 31, 2021 at 2:01 AM Wong, Vee Khee <vee.khee.wong@intel.com> wrote:
>
> Hi all,
>
>
>
> This patch introduced the following massive warnings printouts on a
>
> Intel x86 Alderlake platform with STMMAC MAC and Marvell 88E2110 PHY.
>
>
>
> [  149.674232] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> [  159.930310] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> [  170.186205] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> [  180.434311] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> [  190.682309] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> [  200.690176] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> [  210.938310] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> [  221.186311] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> [  231.442311] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> [  241.690186] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> [  251.698288] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> [  261.946311] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> [  272.194181] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> [  282.442311] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> [  292.690310] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> [  302.938313] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> [  313.186255] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> [  323.442329] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> [  333.698309] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> [  343.946310] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> [  354.202166] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> [  364.450190] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
> [  374.706314] unregister_netdevice: waiting for sit0 to become free. Usage count = 2
>
>
>
> Is this an expected behavior?
>
>
>
> Thanks,
>
> VK

Same answer than the other thread :

Nope, I already have a fix, but it depends on a pending patch.

https://patchwork.kernel.org/project/netdevbpf/patch/20210330064551.545964-1-eric.dumazet@gmail.com/

(I need the patch being merged to add a corresponding Fixes: tag)

You can try the attached patch :

[-- Attachment #2: 0001-ipv6-remove-extra-dev_hold-for-fallback-tunnels.patch --]
[-- Type: text/x-patch, Size: 3126 bytes --]

From 2c9cce067a9a1aec32b323ef80179b1856c796af Mon Sep 17 00:00:00 2001
From: Eric Dumazet <edumazet@google.com>
Date: Tue, 30 Mar 2021 13:29:08 -0700
Subject: [PATCH net-next] ipv6: remove extra dev_hold() for fallback tunnels

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: f21eb0195662 ("ip6_tunnel: sit: proper dev_{hold|put} in ndo_[un]init methods")
Fixes: 6289a98f0817 ("sit: proper dev_{hold|put} in ndo_[un]init methods")
Fixes: 40cb881b5aaa ("ip6_vti: proper dev_{hold|put} in ndo_[un]init methods")
Fixes: 7f700334be9a ("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>
---
 net/ipv6/ip6_gre.c    | 3 ---
 net/ipv6/ip6_tunnel.c | 1 -
 net/ipv6/ip6_vti.c    | 1 -
 net/ipv6/sit.c        | 1 -
 4 files changed, 6 deletions(-)

diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 9689bf9f46f347562330a4d8630c0b0b13a411fc..bc224f917bbd53beb9b8af5bdef3fb9794b8ee44 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -387,7 +387,6 @@ static struct ip6_tnl *ip6gre_tunnel_locate(struct net *net,
 	if (!(nt->parms.o_flags & TUNNEL_SEQ))
 		dev->features |= NETIF_F_LLTX;
 
-	dev_hold(dev);
 	ip6gre_tunnel_link(ign, nt);
 	return nt;
 
@@ -1539,8 +1538,6 @@ static void ip6gre_fb_tunnel_init(struct net_device *dev)
 	strcpy(tunnel->parms.name, dev->name);
 
 	tunnel->hlen		= sizeof(struct ipv6hdr) + 4;
-
-	dev_hold(dev);
 }
 
 static struct inet6_protocol ip6gre_protocol __read_mostly = {
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 67ee9d58ec5efcc81e8b27406bd4f57a0caea70b..07a0a06a9b52bc9974e2f36b1477c341c952f94a 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1925,7 +1925,6 @@ static int __net_init ip6_fb_tnl_dev_init(struct net_device *dev)
 	struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);
 
 	t->parms.proto = IPPROTO_IPV6;
-	dev_hold(dev);
 
 	rcu_assign_pointer(ip6n->tnls_wc[0], t);
 	return 0;
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index a018afdb3e062c9e664d4ca424176a859f0a332c..856e46ad0895b47b58896852afee3d4a398b139e 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -963,7 +963,6 @@ static int __net_init vti6_fb_tnl_dev_init(struct net_device *dev)
 	struct vti6_net *ip6n = net_generic(net, vti6_net_id);
 
 	t->parms.proto = IPPROTO_IPV6;
-	dev_hold(dev);
 
 	rcu_assign_pointer(ip6n->tnls_wc[0], t);
 	return 0;
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 488d3181aec3a5558dbefb6145400627535df761..ff2ca2e7c7f5045663069ea572560d58abee2970 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1470,7 +1470,6 @@ static void __net_init ipip6_fb_tunnel_init(struct net_device *dev)
 	iph->ihl		= 5;
 	iph->ttl		= 64;
 
-	dev_hold(dev);
 	rcu_assign_pointer(sitn->tunnels_wc[0], tunnel);
 }
 
-- 
2.31.0.291.g576ba9dcdaf-goog


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next] sit: proper dev_{hold|put} in ndo_[un]init methods
  2021-03-29 19:25 Eric Dumazet
@ 2021-03-29 23:40 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-03-29 23:40 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: davem, kuba, netdev, edumazet, syzkaller

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Mon, 29 Mar 2021 12:25:22 -0700 you wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> After adopting CONFIG_PCPU_DEV_REFCNT=n option, syzbot was able to trigger
> a warning [1]
> 
> Issue here is that:
> 
> [...]

Here is the summary with links:
  - [net-next] sit: proper dev_{hold|put} in ndo_[un]init methods
    https://git.kernel.org/netdev/net-next/c/6289a98f0817

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH net-next] sit: proper dev_{hold|put} in ndo_[un]init methods
@ 2021-03-29 19:25 Eric Dumazet
  2021-03-29 23:40 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Dumazet @ 2021-03-29 19:25 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski
  Cc: netdev, Eric Dumazet, Eric Dumazet, syzbot

From: Eric Dumazet <edumazet@google.com>

After adopting CONFIG_PCPU_DEV_REFCNT=n option, syzbot was able to trigger
a warning [1]

Issue here is that:

- all dev_put() should be paired with a corresponding prior dev_hold().

- A driver doing a dev_put() in its ndo_uninit() MUST also
  do a dev_hold() in its ndo_init(), only when ndo_init()
  is returning 0.

Otherwise, register_netdevice() would call ndo_uninit()
in its error path and release a refcount too soon.

Fixes: 919067cc845f ("net: add CONFIG_PCPU_DEV_REFCNT")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
---
 net/ipv6/sit.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index b9bd2723f89a314d15c8c4ea785e84530c8acb95..488d3181aec3a5558dbefb6145400627535df761 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -218,8 +218,6 @@ static int ipip6_tunnel_create(struct net_device *dev)
 
 	ipip6_tunnel_clone_6rd(dev, sitn);
 
-	dev_hold(dev);
-
 	ipip6_tunnel_link(sitn, t);
 	return 0;
 
@@ -1456,7 +1454,7 @@ static int ipip6_tunnel_init(struct net_device *dev)
 		dev->tstats = NULL;
 		return err;
 	}
-
+	dev_hold(dev);
 	return 0;
 }
 
-- 
2.31.0.291.g576ba9dcdaf-goog


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-08-16 15:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-31  0:05 [PATCH net-next] sit: proper dev_{hold|put} in ndo_[un]init methods Wong, Vee Khee
2021-03-31  5:53 ` Eric Dumazet
     [not found] <BYAPR11MB2870B0910C71BDDFD328B339AB7C9@BYAPR11MB2870.namprd11.prod.outlook.com>
2021-03-31  5:58 ` Eric Dumazet
2021-03-31  8:51   ` Wong, Vee Khee
2021-03-31  9:02     ` Eric Dumazet
2021-08-16 15:13   ` Alarig Le Lay
  -- strict thread matches above, loose matches on Subject: below --
2021-03-29 19:25 Eric Dumazet
2021-03-29 23:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).