From: Senthil Balasubramanian <senthilkumar@atheros.com>
To: <linville@tuxdriver.com>
Cc: <jouni.malinen@atheros.com>, <luis.rodriguez@atheros.com>,
<linux-wireless@vger.kernel.org>, <ath9k-devel@lists.ath9k.org>,
Senthil Balasubramanian <senthilkumar@atheros.com>
Subject: [PATCH 5/7] ath9k: race condition in SCANNING state check during ANI calibration
Date: Wed, 10 Jun 2009 21:55:30 +0530 [thread overview]
Message-ID: <1244651133-6537-6-git-send-email-senthilkumar@atheros.com> (raw)
In-Reply-To: <1244651133-6537-5-git-send-email-senthilkumar@atheros.com>
ANI calibration shouldn't be done when we are not on our home channel.
This is already verified. However, it is racy. Fix this by proper
spin locks.
Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
---
drivers/net/wireless/ath/ath9k/ath9k.h | 1 +
drivers/net/wireless/ath/ath9k/main.c | 11 +++++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 2a3c66f..71d71c0 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -568,6 +568,7 @@ struct ath_softc {
int irq;
spinlock_t sc_resetlock;
spinlock_t sc_serial_rw;
+ spinlock_t ani_lock;
struct mutex mutex;
u8 curbssid[ETH_ALEN];
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 10dc7d1..e2c8649 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -326,6 +326,7 @@ static void ath_ani_calibrate(unsigned long data)
* don't calibrate when we're scanning.
* we are most likely not on our home channel.
*/
+ spin_lock(&sc->ani_lock);
if (sc->sc_flags & SC_OP_SCANNING)
goto set_timer;
@@ -389,6 +390,7 @@ static void ath_ani_calibrate(unsigned long data)
ath9k_ps_restore(sc);
set_timer:
+ spin_unlock(&sc->ani_lock);
/*
* Set timer interval based on previous results.
* The interval must be the shortest necessary to satisfy ANI,
@@ -1348,6 +1350,7 @@ static int ath_init(u16 devid, struct ath_softc *sc)
spin_lock_init(&sc->wiphy_lock);
spin_lock_init(&sc->sc_resetlock);
spin_lock_init(&sc->sc_serial_rw);
+ spin_lock_init(&sc->ani_lock);
mutex_init(&sc->mutex);
tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc);
tasklet_init(&sc->bcon_tasklet, ath_beacon_tasklet,
@@ -2732,9 +2735,9 @@ static void ath9k_sw_scan_start(struct ieee80211_hw *hw)
aphy->state = ATH_WIPHY_SCAN;
ath9k_wiphy_pause_all_forced(sc, aphy);
- mutex_lock(&sc->mutex);
+ spin_lock_bh(&sc->ani_lock);
sc->sc_flags |= SC_OP_SCANNING;
- mutex_unlock(&sc->mutex);
+ spin_unlock_bh(&sc->ani_lock);
}
static void ath9k_sw_scan_complete(struct ieee80211_hw *hw)
@@ -2742,11 +2745,11 @@ static void ath9k_sw_scan_complete(struct ieee80211_hw *hw)
struct ath_wiphy *aphy = hw->priv;
struct ath_softc *sc = aphy->sc;
- mutex_lock(&sc->mutex);
+ spin_lock_bh(&sc->ani_lock);
aphy->state = ATH_WIPHY_ACTIVE;
sc->sc_flags &= ~SC_OP_SCANNING;
sc->sc_flags |= SC_OP_FULL_RESET;
- mutex_unlock(&sc->mutex);
+ spin_unlock_bh(&sc->ani_lock);
}
struct ieee80211_ops ath9k_ops = {
--
1.6.0.4
next prev parent reply other threads:[~2009-06-10 16:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-10 16:25 [PATCH 0/7] ATH9K bug fixes - TX hang & Signal Quality issue Senthil Balasubramanian
2009-06-10 16:25 ` [PATCH 1/7] ath9k: Manipulate and report the correct RSSI Senthil Balasubramanian
2009-06-10 16:25 ` [PATCH 2/7] ath9k: AR9285 & AR9280 INI update and minor bug fixes Senthil Balasubramanian
2009-06-10 16:25 ` [PATCH 3/7] ath9k: remove unnecessary STATION mode check Senthil Balasubramanian
2009-06-10 16:25 ` [PATCH 4/7] ath9k: stop ani when the STA gets disconnected Senthil Balasubramanian
2009-06-10 16:25 ` Senthil Balasubramanian [this message]
2009-06-10 16:25 ` [PATCH 6/7] ath9k: Fix TX hang issue with Atheros chipsets Senthil Balasubramanian
2009-06-10 16:25 ` [PATCH 7/7] ath9k: schedule aggregation regardless of queue depth Senthil Balasubramanian
2009-06-10 16:25 ` [PATCH] ath9k: Fix panic when ath9k is unloaded Senthil Balasubramanian
2009-06-10 16:31 ` Senthil Balasubramanian
2009-06-17 18:58 ` [PATCH 0/7] ATH9K bug fixes - TX hang & Signal Quality issue John W. Linville
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1244651133-6537-6-git-send-email-senthilkumar@atheros.com \
--to=senthilkumar@atheros.com \
--cc=ath9k-devel@lists.ath9k.org \
--cc=jouni.malinen@atheros.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=luis.rodriguez@atheros.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).