summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2016-06-06 22:59:58 +0000
committerbz <bz@FreeBSD.org>2016-06-06 22:59:58 +0000
commit5365a749e6c7939e1bf00b9733d2b3641609aada (patch)
treec2610ba4011b727b27ddeca4f8098322dc82e836 /sys/net
parent87e8d06bb3496ce8cee485108c02ddfba7c046c5 (diff)
downloadFreeBSD-src-5365a749e6c7939e1bf00b9733d2b3641609aada.zip
FreeBSD-src-5365a749e6c7939e1bf00b9733d2b3641609aada.tar.gz
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
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index a9f2baf..4d475d9 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);
OpenPOWER on IntegriCloud