From 5c600a90ded725768b3ead947a28a6648c065559 Mon Sep 17 00:00:00 2001 From: Sam Leffler Date: Tue, 2 Jun 2009 18:55:27 +0000 Subject: [PATCH] move if_detach to the top of ieee80211_ifdetach to close various races Reviewed by: jhb --- sys/net80211/ieee80211.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index b7cca98892b8..93bb0ae378fe 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -313,6 +313,8 @@ ieee80211_ifdetach(struct ieee80211com *ic) struct ifnet *ifp = ic->ic_ifp; struct ieee80211vap *vap; + if_detach(ifp); + while ((vap = TAILQ_FIRST(&ic->ic_vaps)) != NULL) ieee80211_vap_destroy(vap); ieee80211_waitfor_parent(ic); @@ -329,11 +331,10 @@ ieee80211_ifdetach(struct ieee80211com *ic) ieee80211_crypto_detach(ic); ieee80211_power_detach(ic); ieee80211_node_detach(ic); - ifmedia_removeall(&ic->ic_media); + ifmedia_removeall(&ic->ic_media); taskqueue_free(ic->ic_tq); IEEE80211_LOCK_DESTROY(ic); - if_detach(ifp); } /*