ath5k: use spin_lock_irqsave for beacon lock
authorBob Copeland <me@bobcopeland.com>
Sun, 15 Feb 2009 17:06:10 +0000 (12:06 -0500)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 27 Feb 2009 19:52:36 +0000 (14:52 -0500)
ath5k_reset can be called from process context, which in turn can
call ath5k_beacon_config which takes the sc->block spinlock.  Since
it can also be taken in hard irq context, use spin_lock_irqsave
everywhere.  This fixes a potential deadlock in adhoc mode.

Changes-licensed-under: 3-Clause-BSD

Cc: stable@kernel.org
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath5k/base.c

index d930c10a7e5202f16a46c59539ca95b60cb9282a..8e5620afd2f99fd1e85d98dd20ba5f1258f02a56 100644 (file)
@@ -1700,7 +1700,6 @@ ath5k_check_ibss_tsf(struct ath5k_softc *sc, struct sk_buff *skb,
        }
 }
 
-
 static void
 ath5k_tasklet_rx(unsigned long data)
 {
@@ -2216,6 +2215,7 @@ static void
 ath5k_beacon_config(struct ath5k_softc *sc)
 {
        struct ath5k_hw *ah = sc->ah;
+       unsigned long flags;
 
        ath5k_hw_set_imr(ah, 0);
        sc->bmisscount = 0;
@@ -2237,9 +2237,9 @@ ath5k_beacon_config(struct ath5k_softc *sc)
 
                if (sc->opmode == NL80211_IFTYPE_ADHOC) {
                        if (ath5k_hw_hasveol(ah)) {
-                               spin_lock(&sc->block);
+                               spin_lock_irqsave(&sc->block, flags);
                                ath5k_beacon_send(sc);
-                               spin_unlock(&sc->block);
+                               spin_unlock_irqrestore(&sc->block, flags);
                        }
                } else
                        ath5k_beacon_update_timers(sc, -1);