Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Jun 2020 16:57:30 +0000 (UTC)
From:      Ryan Moeller <freqlabs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r361756 - head/sys/netinet6
Message-ID:  <202006031657.053GvUut003757@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006031657.053GvUut003757>