]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ath9k: another fix for the A-MPDU buffer leak
authorFelix Fietkau <nbd@openwrt.org>
Mon, 12 Jul 2010 21:16:34 +0000 (23:16 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 10 Aug 2010 18:09:19 +0000 (11:09 -0700)
commit 31e79a5954b78fbed15de2c8974d5a2b6019199a upstream.

The patch 'ath9k: fix a buffer leak in A-MPDU completion' addressed the
issue of running out of buffers/descriptors in the tx path if a STA is
deleted while tx status feedback is still pending.
The remaining issue is that the skbs of the buffers are not reclaimed,
leaving a memory leak.
This patch fixes this issue by running the buffers through
ath_tx_complete_buf(), ensuring that the pending frames counter is also
updated.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/net/wireless/ath/ath9k/xmit.c

index 191794ec7eb30d51d993c75bb86aa7ebdc070d3a..c20a3d6a2e030d4d0eaa518a254521db85e890f1 100644 (file)
@@ -329,7 +329,6 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
        int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0;
        bool rc_update = true;
        struct ieee80211_tx_rate rates[4];
-       unsigned long flags;
 
        skb = bf->bf_mpdu;
        hdr = (struct ieee80211_hdr *)skb->data;
@@ -346,9 +345,21 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
        if (!sta) {
                rcu_read_unlock();
 
-               spin_lock_irqsave(&sc->tx.txbuflock, flags);
-               list_splice_tail_init(bf_q, &sc->tx.txbuf);
-               spin_unlock_irqrestore(&sc->tx.txbuflock, flags);
+               INIT_LIST_HEAD(&bf_head);
+               while (bf) {
+                       bf_next = bf->bf_next;
+
+                       bf->bf_state.bf_type |= BUF_XRETRY;
+                       if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) ||
+                           !bf->bf_stale || bf_next != NULL)
+                               list_move_tail(&bf->list, &bf_head);
+
+                       ath_tx_rc_status(bf, ts, 0, 0, false);
+                       ath_tx_complete_buf(sc, bf, txq, &bf_head, ts,
+                               0, 0);
+
+                       bf = bf_next;
+               }
                return;
        }