svn commit: r361756 - head/sys/netinet6

Ryan Moeller freqlabs at FreeBSD.org
Wed Jun 3 16:57:30 UTC 2020


Author: freqlabs
Date: Wed Jun  3 16:57:30 2020
New Revision: 361756
URL: https://svnweb.freebsd.org/changeset/base/361756

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

Modified:
  head/sys/netinet6/scope6.c

Modified: head/sys/netinet6/scope6.c
==============================================================================
--- head/sys/netinet6/scope6.c	Wed Jun  3 16:51:30 2020	(r361755)
+++ head/sys/netinet6/scope6.c	Wed Jun  3 16:57:30 2020	(r361756)
@@ -422,6 +422,10 @@ in6_setscope(struct in6_addr *in6, struct ifnet *ifp, 
 			struct epoch_tracker et;
 
 			NET_EPOCH_ENTER(et);
+			if (ifp->if_afinfo[AF_INET6] == NULL) {
+				NET_EPOCH_EXIT(et);
+				return (ENETDOWN);
+			}
 			sid = SID(ifp);
 			zoneid = sid->s6id_list[scope];
 			NET_EPOCH_EXIT(et);


More information about the svn-src-head mailing list