diff options
author | Bjoern A. Zeeb <bz@FreeBSD.org> | 2016-06-06 22:59:58 +0000 |
---|---|---|
committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2016-06-06 22:59:58 +0000 |
commit | 2d5ad99a0d9109611d6cfcdceefce668c8dd7c47 (patch) | |
tree | c2610ba4011b727b27ddeca4f8098322dc82e836 /sys/net/if.c | |
parent | c152ba971f88085f7d6f5da6b10884235a83bbdb (diff) | |
download | src-2d5ad99a0d9109611d6cfcdceefce668c8dd7c47.tar.gz src-2d5ad99a0d9109611d6cfcdceefce668c8dd7c47.zip |
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
Notes
Notes:
svn path=/head/; revision=301533
Diffstat (limited to 'sys/net/if.c')
-rw-r--r-- | sys/net/if.c | 4 |
1 files changed, 3 insertions, 1 deletions
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); |