[IPV6]: Fix refcounting for anycast dst entries. The problem occures when we stop IPv6 device without dropping all addresses on it. For such a device addrconf_ifdown marks all entries as obsolete and ip6_del_rt called from __ipv6_dev_ac_dec return ENOENT. The referrence is not dropped. The fix is simple. DST entry should not keep referrence when stored in the FIB6 tree. Signed-off-by: Denis V. Lunev --- ./net/ipv6/anycast.c.ac1 2008-03-17 17:29:55.000000000 +0300 +++ ./net/ipv6/anycast.c 2008-03-18 11:16:23.000000000 +0300 @@ -347,9 +347,7 @@ int ipv6_dev_ac_inc(struct net_device *d idev->ac_list = aca; write_unlock_bh(&idev->lock); - dst_hold(&rt->u.dst); - if (ip6_ins_rt(rt, NULL, NULL, NULL)) - dst_release(&rt->u.dst); + ip6_ins_rt(rt, NULL, NULL, NULL); addrconf_join_solict(dev, &aca->aca_addr); @@ -394,10 +392,7 @@ int __ipv6_dev_ac_dec(struct inet6_dev * addrconf_leave_solict(idev, &aca->aca_addr); dst_hold(&aca->aca_rt->u.dst); - if (ip6_del_rt(aca->aca_rt, NULL, NULL, NULL)) - dst_free(&aca->aca_rt->u.dst); - else - dst_release(&aca->aca_rt->u.dst); + ip6_del_rt(aca->aca_rt, NULL, NULL, NULL); aca_put(aca); return 0;