提交 00482973 编写于 作者: J Jiri Slaby 提交者: John W. Linville

Ath5k: lock beacons

Beacons setup and config was racy with beacon send. Ensure that
ISR and reset functions see consistent state of bbuf.

Use also dev_kfree_skb_any in ath5k_txbuf_free since we call it
from atomic now.
Signed-off-by: NJiri Slaby <jirislaby@gmail.com>
Cc: Nick Kossifidis <mickflemm@gmail.com>
Cc: Luis R. Rodriguez <mcgrof@gmail.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 d0c2912f
...@@ -251,7 +251,7 @@ static inline void ath5k_txbuf_free(struct ath5k_softc *sc, ...@@ -251,7 +251,7 @@ static inline void ath5k_txbuf_free(struct ath5k_softc *sc,
return; return;
pci_unmap_single(sc->pdev, bf->skbaddr, bf->skb->len, pci_unmap_single(sc->pdev, bf->skbaddr, bf->skb->len,
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
dev_kfree_skb(bf->skb); dev_kfree_skb_any(bf->skb);
bf->skb = NULL; bf->skb = NULL;
} }
...@@ -466,6 +466,7 @@ ath5k_pci_probe(struct pci_dev *pdev, ...@@ -466,6 +466,7 @@ ath5k_pci_probe(struct pci_dev *pdev,
mutex_init(&sc->lock); mutex_init(&sc->lock);
spin_lock_init(&sc->rxbuflock); spin_lock_init(&sc->rxbuflock);
spin_lock_init(&sc->txbuflock); spin_lock_init(&sc->txbuflock);
spin_lock_init(&sc->block);
/* Set private data */ /* Set private data */
pci_set_drvdata(pdev, hw); pci_set_drvdata(pdev, hw);
...@@ -2179,8 +2180,11 @@ ath5k_beacon_config(struct ath5k_softc *sc) ...@@ -2179,8 +2180,11 @@ ath5k_beacon_config(struct ath5k_softc *sc)
sc->imask |= AR5K_INT_SWBA; sc->imask |= AR5K_INT_SWBA;
if (ath5k_hw_hasveol(ah)) if (ath5k_hw_hasveol(ah)) {
spin_lock(&sc->block);
ath5k_beacon_send(sc); ath5k_beacon_send(sc);
spin_unlock(&sc->block);
}
} }
/* TODO else AP */ /* TODO else AP */
...@@ -2403,7 +2407,9 @@ ath5k_intr(int irq, void *dev_id) ...@@ -2403,7 +2407,9 @@ ath5k_intr(int irq, void *dev_id)
TSF_TO_TU(tsf), TSF_TO_TU(tsf),
(unsigned long long) tsf); (unsigned long long) tsf);
} else { } else {
spin_lock(&sc->block);
ath5k_beacon_send(sc); ath5k_beacon_send(sc);
spin_unlock(&sc->block);
} }
} }
if (status & AR5K_INT_RXEOL) { if (status & AR5K_INT_RXEOL) {
...@@ -3050,6 +3056,7 @@ static int ...@@ -3050,6 +3056,7 @@ static int
ath5k_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) ath5k_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
{ {
struct ath5k_softc *sc = hw->priv; struct ath5k_softc *sc = hw->priv;
unsigned long flags;
int ret; int ret;
ath5k_debug_dump_skb(sc, skb, "BC ", 1); ath5k_debug_dump_skb(sc, skb, "BC ", 1);
...@@ -3059,12 +3066,14 @@ ath5k_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) ...@@ -3059,12 +3066,14 @@ ath5k_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
goto end; goto end;
} }
spin_lock_irqsave(&sc->block, flags);
ath5k_txbuf_free(sc, sc->bbuf); ath5k_txbuf_free(sc, sc->bbuf);
sc->bbuf->skb = skb; sc->bbuf->skb = skb;
ret = ath5k_beacon_setup(sc, sc->bbuf); ret = ath5k_beacon_setup(sc, sc->bbuf);
if (ret) if (ret)
sc->bbuf->skb = NULL; sc->bbuf->skb = NULL;
else { spin_unlock_irqrestore(&sc->block, flags);
if (!ret) {
ath5k_beacon_config(sc); ath5k_beacon_config(sc);
mmiowb(); mmiowb();
} }
......
...@@ -172,6 +172,7 @@ struct ath5k_softc { ...@@ -172,6 +172,7 @@ struct ath5k_softc {
struct tasklet_struct txtq; /* tx intr tasklet */ struct tasklet_struct txtq; /* tx intr tasklet */
struct ath5k_led tx_led; /* tx led */ struct ath5k_led tx_led; /* tx led */
spinlock_t block; /* protects beacon */
struct ath5k_buf *bbuf; /* beacon buffer */ struct ath5k_buf *bbuf; /* beacon buffer */
unsigned int bhalq, /* SW q for outgoing beacons */ unsigned int bhalq, /* SW q for outgoing beacons */
bmisscount, /* missed beacon transmits */ bmisscount, /* missed beacon transmits */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册