svn commit: r301533 - head/sys/net

Bjoern A. Zeeb bz at FreeBSD.org
Mon Jun 6 23:00:00 UTC 2016


Author: bz
Date: Mon Jun  6 22:59:58 2016
New Revision: 301533
URL: https://svnweb.freebsd.org/changeset/base/301533

Log:
  After tearing down the interface per-"domain" bits, set the data area
  to NULL to avoid it being mis-treated on a possible re-attach but also
  to get a clean NULL pointer derefence in case of errors due to
  unexpected race conditions elsewhere in the code, e.g., callouts.
  
  Obtained from:	projects/vnet
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/net/if.c

Modified: head/sys/net/if.c
==============================================================================
--- head/sys/net/if.c	Mon Jun  6 22:54:08 2016	(r301532)
+++ head/sys/net/if.c	Mon Jun  6 22:59:58 2016	(r301533)
@@ -1030,9 +1030,11 @@ if_detach_internal(struct ifnet *ifp, in
 	ifp->if_afdata_initialized = 0;
 	IF_AFDATA_UNLOCK(ifp);
 	for (dp = domains; i > 0 && dp; dp = dp->dom_next) {
-		if (dp->dom_ifdetach && ifp->if_afdata[dp->dom_family])
+		if (dp->dom_ifdetach && ifp->if_afdata[dp->dom_family]) {
 			(*dp->dom_ifdetach)(ifp,
 			    ifp->if_afdata[dp->dom_family]);
+			ifp->if_afdata[dp->dom_family] = NULL;
+		}
 	}
 
 	return (0);


More information about the svn-src-head mailing list