From b0cf9f5f207c99328556a7a18a7bc9d65df7f33f Mon Sep 17 00:00:00 2001 From: "Bjoern A. Zeeb" Date: Wed, 21 Apr 2010 19:47:19 +0000 Subject: [PATCH] MFC r206469: 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 --- sys/net/if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/if.c b/sys/net/if.c index 8eff017e29d..fab354fce99 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -931,7 +931,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]);