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/11/sys/netinet6/scope6.c
Directory Properties:
  stable/11/   (props changed)

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

Modified: stable/11/sys/netinet6/scope6.c
==============================================================================
--- stable/11/sys/netinet6/scope6.c     Sat Jun  6 03:09:12 2020        
(r361861)
+++ stable/11/sys/netinet6/scope6.c     Sat Jun  6 03:54:06 2020        
(r361862)
@@ -417,6 +417,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);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to