netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2] ipv6: clean up dev_snmp6 proc entry when we fail to initialize inet6_dev
@ 2015-11-04 13:47 Sabrina Dubroca
  2015-11-04 15:23 ` Eric Dumazet
  2015-11-05  4:56 ` [PATCH net v3] " David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Sabrina Dubroca @ 2015-11-04 13:47 UTC (permalink / raw)
  To: netdev; +Cc: eric.dumazet, dvyukov, hannes, cwang, Sabrina Dubroca

In ipv6_add_dev, when addrconf_sysctl_register fails, we do not clean up
the dev_snmp6 entry that we have already registered for this device.
Call snmp6_unregister_dev in this case.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---

v2: we cannot call snmp6_unregister_dev from addrconf_core.c, this
    breaks CONFIG_IPV6=m, instead do the clean up directly from
    ipv6_add_dev
    thanks Cong.

 net/ipv6/addrconf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 36b85bd05ac8..dd00828863a0 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -417,6 +417,7 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev)
 	if (err) {
 		ipv6_mc_destroy_dev(ndev);
 		del_timer(&ndev->regen_timer);
+		snmp6_unregister_dev(ndev);
 		goto err_release;
 	}
 	/* protected by rtnl_lock */
-- 
2.6.2

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

* Re: [PATCH net v2] ipv6: clean up dev_snmp6 proc entry when we fail to initialize inet6_dev
  2015-11-04 13:47 [PATCH net v2] ipv6: clean up dev_snmp6 proc entry when we fail to initialize inet6_dev Sabrina Dubroca
@ 2015-11-04 15:23 ` Eric Dumazet
  2015-11-04 15:36   ` Sabrina Dubroca
  2015-11-05  4:56 ` [PATCH net v3] " David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2015-11-04 15:23 UTC (permalink / raw)
  To: Sabrina Dubroca; +Cc: netdev, dvyukov, hannes, cwang

On Wed, 2015-11-04 at 14:47 +0100, Sabrina Dubroca wrote:
> In ipv6_add_dev, when addrconf_sysctl_register fails, we do not clean up
> the dev_snmp6 entry that we have already registered for this device.
> Call snmp6_unregister_dev in this case.
> 
> Reported-by: Dmitry Vyukov <dvyukov@google.com>
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
> ---
> 
> v2: we cannot call snmp6_unregister_dev from addrconf_core.c, this
>     breaks CONFIG_IPV6=m, instead do the clean up directly from
>     ipv6_add_dev
>     thanks Cong.

Any idea when the bug was added ?

Can we please add a proper Fixes: tag for patches that need to be
backported to stable versions ?

It seems to be

Fixes: a317a2f19da7d ("ipv6: fail early when creating netdev named all or default")

So this goes back to linux-3.17 ?

Thanks a lot Sabrina !

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

* Re: [PATCH net v2] ipv6: clean up dev_snmp6 proc entry when we fail to initialize inet6_dev
  2015-11-04 15:23 ` Eric Dumazet
@ 2015-11-04 15:36   ` Sabrina Dubroca
  0 siblings, 0 replies; 4+ messages in thread
From: Sabrina Dubroca @ 2015-11-04 15:36 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev, dvyukov, hannes, cwang

2015-11-04, 07:23:14 -0800, Eric Dumazet wrote:
> On Wed, 2015-11-04 at 14:47 +0100, Sabrina Dubroca wrote:
> > In ipv6_add_dev, when addrconf_sysctl_register fails, we do not clean up
> > the dev_snmp6 entry that we have already registered for this device.
> > Call snmp6_unregister_dev in this case.
> > 
> > Reported-by: Dmitry Vyukov <dvyukov@google.com>
> > Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
> > ---
> > 
> > v2: we cannot call snmp6_unregister_dev from addrconf_core.c, this
> >     breaks CONFIG_IPV6=m, instead do the clean up directly from
> >     ipv6_add_dev
> >     thanks Cong.
> 
> Any idea when the bug was added ?
> 
> Can we please add a proper Fixes: tag for patches that need to be
> backported to stable versions ?
> 
> It seems to be
> 
> Fixes: a317a2f19da7d ("ipv6: fail early when creating netdev named all or default")
> 
> So this goes back to linux-3.17 ?
> 
> Thanks a lot Sabrina !

Sorry, I didn't do the archeology (well, run git blame).  That looks
correct, thanks Eric.

-- 
Sabrina

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

* Re: [PATCH net v3] ipv6: clean up dev_snmp6 proc entry when we fail to initialize inet6_dev
  2015-11-04 13:47 [PATCH net v2] ipv6: clean up dev_snmp6 proc entry when we fail to initialize inet6_dev Sabrina Dubroca
  2015-11-04 15:23 ` Eric Dumazet
@ 2015-11-05  4:56 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2015-11-05  4:56 UTC (permalink / raw)
  To: sd; +Cc: netdev, eric.dumazet, dvyukov, hannes, cwang

From: Sabrina Dubroca <sd@queasysnail.net>
Date: Wed,  4 Nov 2015 18:00:13 +0100

> In ipv6_add_dev, when addrconf_sysctl_register fails, we do not clean up
> the dev_snmp6 entry that we have already registered for this device.
> Call snmp6_unregister_dev in this case.
> 
> Fixes: a317a2f19da7d ("ipv6: fail early when creating netdev named all or default")
> Reported-by: Dmitry Vyukov <dvyukov@google.com>
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>

Applied, thanks.

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

end of thread, other threads:[~2015-11-05  4:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-04 13:47 [PATCH net v2] ipv6: clean up dev_snmp6 proc entry when we fail to initialize inet6_dev Sabrina Dubroca
2015-11-04 15:23 ` Eric Dumazet
2015-11-04 15:36   ` Sabrina Dubroca
2015-11-05  4:56 ` [PATCH net v3] " David Miller

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).