From 2d5ad99a0d9109611d6cfcdceefce668c8dd7c47 Mon Sep 17 00:00:00 2001 From: "Bjoern A. Zeeb" Date: Mon, 6 Jun 2016 22:59:58 +0000 Subject: 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 --- sys/net/if.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sys/net/if.c') diff --git a/sys/net/if.c b/sys/net/if.c index a9f2baf3e24e..4d475d949a35 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1030,9 +1030,11 @@ if_detach_internal(struct ifnet *ifp, int vmove, struct if_clone **ifcp) 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); -- cgit v1.2.3