In if_detach_internal() only try to do the detach run if if_attachdomain1()

has actually succeeded to initialize and attach.  There is a theoretical
possibility to drop out early in if_attachdomain1() leaving the array
uninitialized if we cannot get the lock.

Discussed with:	rwatson
MFC after:	10 days
This commit is contained in:
Bjoern A. Zeeb 2010-04-11 11:49:24 +00:00
parent 086b6e8e54
commit 318c3213e5

View File

@ -898,7 +898,7 @@ if_detach_internal(struct ifnet *ifp, int vmove)
if_delgroups(ifp);
IF_AFDATA_LOCK(ifp);
for (dp = domains; dp; dp = dp->dom_next) {
for (dp = domains; ifp->if_afdata_initialized > 0 && dp; dp = dp->dom_next) {
if (dp->dom_ifdetach && ifp->if_afdata[dp->dom_family])
(*dp->dom_ifdetach)(ifp,
ifp->if_afdata[dp->dom_family]);