From owner-svn-src-all@FreeBSD.ORG Fri Mar 2 02:57:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 416A7106566C; Fri, 2 Mar 2012 02:57:11 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 309FB8FC18; Fri, 2 Mar 2012 02:57:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q222vBQZ010270; Fri, 2 Mar 2012 02:57:11 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q222vAhj010268; Fri, 2 Mar 2012 02:57:10 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201203020257.q222vAhj010268@svn.freebsd.org> From: Adrian Chadd Date: Fri, 2 Mar 2012 02:57:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232374 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 02 Mar 2012 02:57:11 -0000 Author: adrian Date: Fri Mar 2 02:57:10 2012 New Revision: 232374 URL: http://svn.freebsd.org/changeset/base/232374 Log: Wrap the scan code state change stuff behind ATH_LOCK and the PCU fiddling behind the PCU lock. sc_scanning is being checked without ATH_LOCK behind held and could in theory run from multiple threads. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Fri Mar 2 02:53:43 2012 (r232373) +++ head/sys/dev/ath/if_ath.c Fri Mar 2 02:57:10 2012 (r232374) @@ -5637,11 +5637,16 @@ ath_scan_start(struct ieee80211com *ic) /* XXX calibration timer? */ + ATH_LOCK(sc); sc->sc_scanning = 1; sc->sc_syncbeacon = 0; rfilt = ath_calcrxfilter(sc); + ATH_UNLOCK(sc); + + ATH_PCU_LOCK(sc); ath_hal_setrxfilter(ah, rfilt); ath_hal_setassocid(ah, ifp->if_broadcastaddr, 0); + ATH_PCU_UNLOCK(sc); DPRINTF(sc, ATH_DEBUG_STATE, "%s: RX filter 0x%x bssid %s aid 0\n", __func__, rfilt, ether_sprintf(ifp->if_broadcastaddr)); @@ -5655,12 +5660,17 @@ ath_scan_end(struct ieee80211com *ic) struct ath_hal *ah = sc->sc_ah; u_int32_t rfilt; + ATH_LOCK(sc); sc->sc_scanning = 0; rfilt = ath_calcrxfilter(sc); + ATH_UNLOCK(sc); + + ATH_PCU_LOCK(sc); ath_hal_setrxfilter(ah, rfilt); ath_hal_setassocid(ah, sc->sc_curbssid, sc->sc_curaid); ath_hal_process_noisefloor(ah); + ATH_PCU_UNLOCK(sc); DPRINTF(sc, ATH_DEBUG_STATE, "%s: RX filter 0x%x bssid %s aid 0x%x\n", __func__, rfilt, ether_sprintf(sc->sc_curbssid),