Author: avos
Date: Sun Feb 28 23:35:03 2016
New Revision: 296169
URL: https://svnweb.freebsd.org/changeset/base/296169

Log:
  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

Modified:
  head/sys/net80211/ieee80211_ioctl.c

Modified: head/sys/net80211/ieee80211_ioctl.c
==============================================================================
--- head/sys/net80211/ieee80211_ioctl.c Sun Feb 28 22:37:59 2016        
(r296168)
+++ head/sys/net80211/ieee80211_ioctl.c Sun Feb 28 23:35:03 2016        
(r296169)
@@ -3289,7 +3289,7 @@ ieee80211_ioctl(struct ifnet *ifp, u_lon
 {
        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_lon
                         * 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:
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to