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;
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to