svn commit: r236327 - head/sys/netinet6

Maksim Yevmenkin emax at FreeBSD.org
Wed May 30 20:02:40 UTC 2012


Author: emax
Date: Wed May 30 20:02:39 2012
New Revision: 236327
URL: http://svn.freebsd.org/changeset/base/236327

Log:
  When we return deprecated addresses, we need to reference them.
  
  Reviewed by:	bz, scottl
  MFC after:	3 days

Modified:
  head/sys/netinet6/in6.c

Modified: head/sys/netinet6/in6.c
==============================================================================
--- head/sys/netinet6/in6.c	Wed May 30 19:21:54 2012	(r236326)
+++ head/sys/netinet6/in6.c	Wed May 30 20:02:39 2012	(r236327)
@@ -2265,14 +2265,20 @@ in6_ifawithifp(struct ifnet *ifp, struct
 		IF_ADDR_RUNLOCK(ifp);
 		return (struct in6_ifaddr *)ifa;
 	}
-	IF_ADDR_RUNLOCK(ifp);
 
 	/* use the last-resort values, that are, deprecated addresses */
-	if (dep[0])
+	if (dep[0]) {
+		ifa_ref((struct ifaddr *)dep[0]);
+		IF_ADDR_RUNLOCK(ifp);
 		return dep[0];
-	if (dep[1])
+	}
+	if (dep[1]) {
+		ifa_ref((struct ifaddr *)dep[1]);
+		IF_ADDR_RUNLOCK(ifp);
 		return dep[1];
+	}
 
+	IF_ADDR_RUNLOCK(ifp);
 	return NULL;
 }
 


More information about the svn-src-head mailing list