diff options
author | Stanislaw Gruszka <sgruszka@redhat.com> | 2011-01-25 14:08:40 +0100 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-01-27 16:41:08 -0500 |
commit | 203043f579ece44bb30291442cd56332651dd37d (patch) | |
tree | aa219eadbff45abf09011f595fa27febb6152ee7 /drivers/net/wireless/ath/ath9k/main.c | |
parent | c9234a662e38309d6fe272ad80e6cdb8d24654f0 (diff) | |
download | kernel_samsung_tuna-203043f579ece44bb30291442cd56332651dd37d.zip kernel_samsung_tuna-203043f579ece44bb30291442cd56332651dd37d.tar.gz kernel_samsung_tuna-203043f579ece44bb30291442cd56332651dd37d.tar.bz2 |
ath9k: fix race conditions when stop device
We do not kill any scheduled tasklets when stopping device, that may
cause usage of resources after free. Moreover we enable interrupts
in tasklet function, so we could potentially end with interrupts
enabled when driver is not ready to receive them.
I think patch should fix Ben's kernel crash from:
http://marc.info/?l=linux-wireless&m=129438358921501&w=2
Cc: stable@kernel.org
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/main.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/main.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index c79c97b..ace9f06 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c @@ -1309,6 +1309,9 @@ static void ath9k_stop(struct ieee80211_hw *hw) spin_lock_bh(&sc->sc_pcu_lock); + /* prevent tasklets to enable interrupts once we disable them */ + ah->imask &= ~ATH9K_INT_GLOBAL; + /* make sure h/w will not generate any interrupt * before setting the invalid flag. */ ath9k_hw_disable_interrupts(ah); @@ -1326,6 +1329,12 @@ static void ath9k_stop(struct ieee80211_hw *hw) spin_unlock_bh(&sc->sc_pcu_lock); + /* we can now sync irq and kill any running tasklets, since we already + * disabled interrupts and not holding a spin lock */ + synchronize_irq(sc->irq); + tasklet_kill(&sc->intr_tq); + tasklet_kill(&sc->bcon_tasklet); + ath9k_ps_restore(sc); sc->ps_idle = true; |