svn commit: r361862 - in stable: 11/sys/netinet6 12/sys/netinet6

Ryan Moeller freqlabs at FreeBSD.org
Sat Jun 6 03:54:07 UTC 2020


Author: freqlabs
Date: Sat Jun  6 03:54:06 2020
New Revision: 361862
URL: https://svnweb.freebsd.org/changeset/base/361862

Log:
  MFC r361756, r361757:
  
  scope6: Check for NULL afdata before dereferencing
  
  Narrows the race window with if_detach.
  
  Approved by:    mav (mentor)
  Sponsored by:   iXsystems, Inc.
  Differential Revision:  https://reviews.freebsd.org/D25017

Modified:
  stable/12/sys/netinet6/scope6.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/netinet6/scope6.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/netinet6/scope6.c
==============================================================================
--- stable/12/sys/netinet6/scope6.c	Sat Jun  6 03:09:12 2020	(r361861)
+++ stable/12/sys/netinet6/scope6.c	Sat Jun  6 03:54:06 2020	(r361862)
@@ -419,6 +419,10 @@ in6_setscope(struct in6_addr *in6, struct ifnet *ifp, 
 			in6->s6_addr16[1] = htons(zoneid & 0xffff); /* XXX */
 		} else if (scope != IPV6_ADDR_SCOPE_GLOBAL) {
 			IF_AFDATA_RLOCK(ifp);
+			if (ifp->if_afdata[AF_INET6] == NULL) {
+				IF_AFDATA_RUNLOCK(ifp);
+				return (ENETDOWN);
+			}
 			sid = SID(ifp);
 			zoneid = sid->s6id_list[scope];
 			IF_AFDATA_RUNLOCK(ifp);


More information about the svn-src-all mailing list