Re: [IPV6] Fix refcnt leak in addrconf regen timer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In article <20030709121656.GA25802@gondor.apana.org.au> (at Wed, 9 Jul 2003 22:16:56 +1000), Herbert Xu <herbert@gondor.apana.org.au> says:

> @@ -1934,6 +1939,10 @@
>  #ifdef CONFIG_SYSCTL
>  		addrconf_sysctl_unregister(&idev->cnf);
>  		neigh_sysctl_unregister(idev->nd_parms);
> +#endif
> +#ifdef CONFIG_IPV6_PRIVACY
> +		if (del_timer(&idev->regen_timer))
> +			in6_dev_put(idev);
>  #endif
>  		neigh_parms_release(&nd_tbl, idev->nd_parms);
>  		in6_dev_put(idev);

Hmm, please try this.

Index: net/ipv6/addrconf.c
===================================================================
RCS file: /home/cvs/linux-2.5/net/ipv6/addrconf.c,v
retrieving revision 1.44
diff -u -r1.44 addrconf.c
--- net/ipv6/addrconf.c	1 Jul 2003 16:42:06 -0000	1.44
+++ net/ipv6/addrconf.c	9 Jul 2003 11:23:32 -0000
@@ -1907,6 +1907,27 @@
 	/* Step 3: clear address list */
 
 	write_lock_bh(&idev->lock);
+#ifdef CONFIG_IPV6_PRIVACY
+	if (del_timer(&idev->regen_timer))
+		in6_dev_put(idev);
+
+	/* clear tempaddr list */
+	while ((ifa = idev->tempaddr_list) != NULL) {
+		idev->tempaddr_list = ifa->tmp_next;
+		ifa->tmp_next = NULL;
+		ifa->dead = 1;
+		write_unlock_bh(&idev->lock);
+		spin_lock_bh(&ifa->lock);
+		
+		if (ifa->ifpub) {
+			in6_ifa_put(ifa->ifpub);
+			ifa->ifpub = NULL;
+		}
+		spin_unlock_bh(&ifa->lock);
+		in6_ifa_put(ifa);
+		write_lock_bh(&idev->lock);
+	}
+#endif
 	while ((ifa = idev->addr_list) != NULL) {
 		idev->addr_list = ifa->if_next;
 		ifa->if_next = NULL;

-- 
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux