From owner-svn-src-all@FreeBSD.ORG Tue Jun 9 17:12:20 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 188011065679; Tue, 9 Jun 2009 17:12:20 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E01B78FC1C; Tue, 9 Jun 2009 17:12:19 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n59HCJEZ078301; Tue, 9 Jun 2009 17:12:19 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n59HCJOJ078300; Tue, 9 Jun 2009 17:12:19 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906091712.n59HCJOJ078300@svn.freebsd.org> From: Sam Leffler Date: Tue, 9 Jun 2009 17:12:19 +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: r193844 - head/sys/net80211 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: Tue, 09 Jun 2009 17:12:20 -0000 Author: sam Date: Tue Jun 9 17:12:19 2009 New Revision: 193844 URL: http://svn.freebsd.org/changeset/base/193844 Log: protect callouts with the com lock Prodded by: jhb Modified: head/sys/net80211/ieee80211_dfs.c Modified: head/sys/net80211/ieee80211_dfs.c ============================================================================== --- head/sys/net80211/ieee80211_dfs.c Tue Jun 9 17:11:41 2009 (r193843) +++ head/sys/net80211/ieee80211_dfs.c Tue Jun 9 17:12:19 2009 (r193844) @@ -69,8 +69,8 @@ ieee80211_dfs_attach(struct ieee80211com { struct ieee80211_dfs_state *dfs = &ic->ic_dfs; - callout_init(&dfs->nol_timer, CALLOUT_MPSAFE); - callout_init(&dfs->cac_timer, CALLOUT_MPSAFE); + callout_init_mtx(&dfs->nol_timer, IEEE80211_LOCK_OBJ(ic), 0); + callout_init_mtx(&dfs->cac_timer, IEEE80211_LOCK_OBJ(ic), 0); } void @@ -102,6 +102,8 @@ cac_timeout(void *arg) struct ieee80211_dfs_state *dfs = &ic->ic_dfs; int i; + IEEE80211_LOCK_ASSERT(ic); + if (vap->iv_state != IEEE80211_S_CAC) /* NB: just in case */ return; /* @@ -120,6 +122,7 @@ cac_timeout(void *arg) /* XXX clobbers any existing desired channel */ /* NB: dfs->newchan may be NULL, that's ok */ vap->iv_des_chan = dfs->newchan; + /* XXX recursive lock need ieee80211_new_state_locked */ ieee80211_new_state(vap, IEEE80211_S_SCAN, 0); } else { if_printf(vap->iv_ifp, @@ -180,7 +183,6 @@ ieee80211_dfs_cac_stop(struct ieee80211v ieee80211_notify_cac(ic, ic->ic_curchan, IEEE80211_NOTIFY_CAC_STOP); } - /* XXX cannot use drain 'cuz holding a lock */ callout_stop(&dfs->cac_timer); } @@ -205,7 +207,8 @@ dfs_timeout(void *arg) struct ieee80211_channel *c; int i, oldest, now; - IEEE80211_LOCK(ic); + IEEE80211_LOCK_ASSERT(ic); + now = oldest = ticks; for (i = 0; i < ic->ic_nchans; i++) { c = &ic->ic_channels[i]; @@ -234,7 +237,6 @@ dfs_timeout(void *arg) /* arrange to process next channel up for a status change */ callout_schedule(&dfs->nol_timer, oldest + NOL_TIMEOUT); } - IEEE80211_UNLOCK(ic); } static void