]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ath9k: fix stale pointers potentially causing access to free'd skbs
authorFelix Fietkau <nbd@openwrt.org>
Thu, 25 Oct 2012 22:31:11 +0000 (00:31 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 17 Nov 2012 21:14:20 +0000 (13:14 -0800)
commit 8c6e30936a7893a85f6222084f0f26aceb81137a upstream.

bf->bf_next is only while buffers are chained as part of an A-MPDU
in the tx queue. When a tid queue is flushed (e.g. on tearing down
an aggregation session), frames can be enqueued again as normal
transmission, without bf_next being cleared. This can lead to the
old pointer being dereferenced again later.

This patch might fix crashes and "Failed to stop TX DMA!" messages.

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

index 33443bcaa8d9b27c6b3a7d70be54a4e470c38efd..6f6f1002e5db6706ceedbcc8fc900efcdbf64071 100644 (file)
@@ -272,6 +272,7 @@ static struct ath_buf *ath_tx_get_buffer(struct ath_softc *sc)
        }
 
        bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list);
+       bf->bf_next = NULL;
        list_del(&bf->list);
 
        spin_unlock_bh(&sc->tx.txbuflock);
@@ -1488,6 +1489,7 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
        if (tid)
                INCR(tid->seq_start, IEEE80211_SEQ_MAX);
 
+       bf->bf_next = NULL;
        bf->bf_lastbf = bf;
        fi = get_frame_info(bf->bf_mpdu);
        ath_buf_set_rate(sc, bf, fi->framelen);