From: Sabrina Dubroca Date: Wed, 4 Nov 2015 13:47:53 +0000 (+0100) Subject: ipv6: clean up dev_snmp6 proc entry when we fail to initialize inet6_dev X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2a189f9e57650e9f310ddf4aad75d66c1233a064;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git ipv6: clean up dev_snmp6 proc entry when we fail to initialize inet6_dev 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 Signed-off-by: Sabrina Dubroca Signed-off-by: David S. Miller --- diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index d72fa90d6feb..d84742f003a9 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -418,6 +418,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 */