ipv6: don't call addrconf_dst_alloc again when enable lo
authorGao feng <gaofeng@cn.fujitsu.com>
Sun, 16 Jun 2013 03:14:30 +0000 (11:14 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 20 Jun 2013 06:04:50 +0000 (23:04 -0700)
If we disable all of the net interfaces, and enable
un-lo interface before lo interface, we already allocated
the addrconf dst in ipv6_add_addr. So we shouldn't allocate
it again when we enable lo interface.

Otherwise the message below will be triggered.
unregister_netdevice: waiting for sit1 to become free. Usage count = 1

This problem is introduced by commit 25fb6ca4ed9cad72f14f61629b68dc03c0d9713f
"net IPv6 : Fix broken IPv6 routing table after loopback down-up"

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/addrconf.c

index 1bbf744c2cc35e7953b9580db08a357f4e829a04..77b626136c238eea791ca8bfdc401c1dd7662f44 100644 (file)
@@ -2655,6 +2655,9 @@ static void init_loopback(struct net_device *dev)
                        if (sp_ifa->flags & (IFA_F_DADFAILED | IFA_F_TENTATIVE))
                                continue;
 
+                       if (sp_ifa->rt)
+                               continue;
+
                        sp_rt = addrconf_dst_alloc(idev, &sp_ifa->addr, 0);
 
                        /* Failure cases are ignored */