From owner-svn-src-all@FreeBSD.ORG Thu Mar 20 04:47:35 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3256F63D; Thu, 20 Mar 2014 04:47:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1F8E0DF1; Thu, 20 Mar 2014 04:47:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s2K4lYxT027138; Thu, 20 Mar 2014 04:47:34 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s2K4lY2c027137; Thu, 20 Mar 2014 04:47:34 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201403200447.s2K4lY2c027137@svn.freebsd.org> From: Adrian Chadd Date: Thu, 20 Mar 2014 04:47:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r263416 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Mar 2014 04:47:35 -0000 Author: adrian Date: Thu Mar 20 04:47:34 2014 New Revision: 263416 URL: http://svnweb.freebsd.org/changeset/base/263416 Log: Don't call ath_init() inside the lock. Yes, this means that sc_invalid is slightly racy, but there are other issues here which need fixing. This fixes a source of eventual LORs - ath_init() grabs ATH_LOCK to do work and releases it before it calls ieee80211_start_all(). ieee80211_start_all() will grab the net80211 comlock to iterate over the VAPs. TODO: * .. I should just migrate the ieee80211_start_all() work to a deferred task so it can be done later; it doesn't have to be immediately done. Tested: * AR5416, STA mode Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Thu Mar 20 02:28:05 2014 (r263415) +++ head/sys/dev/ath/if_ath.c Thu Mar 20 04:47:34 2014 (r263416) @@ -5948,14 +5948,15 @@ ath_ioctl(struct ifnet *ifp, u_long cmd, switch (cmd) { case SIOCSIFFLAGS: - ATH_LOCK(sc); if (IS_RUNNING(ifp)) { /* * To avoid rescanning another access point, * do not call ath_init() here. Instead, * only reflect promisc mode settings. */ + ATH_LOCK(sc); ath_mode_init(sc); + ATH_UNLOCK(sc); } else if (ifp->if_flags & IFF_UP) { /* * Beware of being called during attach/detach @@ -5969,14 +5970,15 @@ ath_ioctl(struct ifnet *ifp, u_long cmd, if (!sc->sc_invalid) ath_init(sc); /* XXX lose error */ } else { + ATH_LOCK(sc); ath_stop_locked(ifp); #ifdef notyet /* XXX must wakeup in places like ath_vap_delete */ if (!sc->sc_invalid) ath_hal_setpower(sc->sc_ah, HAL_PM_FULL_SLEEP); #endif + ATH_UNLOCK(sc); } - ATH_UNLOCK(sc); break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: