1 From: Felix Fietkau <nbd@openwrt.org>
2 Date: Thu, 13 Nov 2014 18:29:26 +0100
3 Subject: [PATCH] ath9k: do not access hardware on IRQs during reset
5 Instead of killing interrupts during reset when the first one happens,
6 kill them before issuing the reset.
7 This fixes an easy to reproduce crash with multiple cards sharing the
10 Cc: stable@vger.kernel.org
11 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
14 --- a/drivers/net/wireless/ath/ath9k/main.c
15 +++ b/drivers/net/wireless/ath/ath9k/main.c
16 @@ -512,16 +512,13 @@ irqreturn_t ath_isr(int irq, void *dev)
17 if (!ah || test_bit(ATH_OP_INVALID, &common->op_flags))
20 - /* shared irq, not for us */
21 + if (!AR_SREV_9100(ah) && test_bit(ATH_OP_HW_RESET, &common->op_flags))
24 + /* shared irq, not for us */
25 if (!ath9k_hw_intrpend(ah))
28 - if (test_bit(ATH_OP_HW_RESET, &common->op_flags)) {
29 - ath9k_hw_kill_interrupts(ah);
34 * Figure out the reason(s) for the interrupt. Note
35 * that the hal returns a pseudo-ISR that may include
36 @@ -532,6 +529,9 @@ irqreturn_t ath_isr(int irq, void *dev)
37 ath9k_debug_sync_cause(sc, sync_cause);
38 status &= ah->imask; /* discard unasked-for bits */
40 + if (AR_SREV_9100(ah) && test_bit(ATH_OP_HW_RESET, &common->op_flags))
44 * If there are no status bits set, then this interrupt was not
45 * for me (should have been caught above).
46 @@ -613,6 +613,7 @@ int ath_reset(struct ath_softc *sc, stru
47 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
50 + ath9k_hw_kill_interrupts(sc->sc_ah);
51 set_bit(ATH_OP_HW_RESET, &common->op_flags);
54 @@ -633,6 +634,7 @@ void ath9k_queue_reset(struct ath_softc
55 #ifdef CPTCFG_ATH9K_DEBUGFS
56 RESET_STAT_INC(sc, type);
58 + ath9k_hw_kill_interrupts(sc->sc_ah);
59 set_bit(ATH_OP_HW_RESET, &common->op_flags);
60 ieee80211_queue_work(sc->hw, &sc->hw_reset_work);