From 11524d60b38c53b074555f1ec061645899768fe8 Mon Sep 17 00:00:00 2001 From: bz Date: Tue, 5 Jun 2012 11:24:05 +0000 Subject: [PATCH] MFC r236327 (by emax): When we return deprecated addresses, we need to reference them. git-svn-id: svn://svn.freebsd.org/base/stable/8@236607 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/netinet6/in6.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index a32545da5..ef5da1e3f 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -2151,14 +2151,20 @@ in6_ifawithifp(struct ifnet *ifp, struct in6_addr *dst) 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; } -- 2.45.0