From 60d75eb64c555367a7529ca977c9e443dd91a6b9 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Sun, 28 Feb 2016 23:35:03 +0000 Subject: [PATCH] net80211: fix 'taskqueue_drain with non-sleepable locks held' warning Do not run ieee80211_waitfor_parent() when it's not needed. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D5446 --- sys/net80211/ieee80211_ioctl.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c index bdaac4810df0..359b1d863331 100644 --- a/sys/net80211/ieee80211_ioctl.c +++ b/sys/net80211/ieee80211_ioctl.c @@ -3289,7 +3289,7 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct ieee80211vap *vap = ifp->if_softc; struct ieee80211com *ic = vap->iv_ic; - int error = 0; + int error = 0, wait = 0; struct ifreq *ifr; struct ifaddr *ifa; /* XXX */ @@ -3308,18 +3308,24 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) * then it will automatically be brought up as a * side-effect of bringing ourself up. */ - if (vap->iv_state == IEEE80211_S_INIT) + if (vap->iv_state == IEEE80211_S_INIT) { + if (ic->ic_nrunning == 0) + wait = 1; ieee80211_start_locked(vap); + } } else if (ifp->if_drv_flags & IFF_DRV_RUNNING) { /* * Stop ourself. If we are the last vap to be * marked down the parent will also be taken down. */ + if (ic->ic_nrunning == 1) + wait = 1; ieee80211_stop_locked(vap); } IEEE80211_UNLOCK(ic); /* Wait for parent ioctl handler if it was queued */ - ieee80211_waitfor_parent(ic); + if (wait) + ieee80211_waitfor_parent(ic); break; case SIOCADDMULTI: case SIOCDELMULTI: