Date: Mon, 6 Jun 2016 22:59:59 +0000 (UTC) From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r301533 - head/sys/net Message-ID: <201606062259.u56MxxMx059296@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606062259.u56MxxMx059296>