Skip to contentSkip to conversation

wifi: ath9k: fix OOB access from firmware tx status queue ID

PATCH Applied Tristan Madani 3 participants 5 messages Apr 15 – May 5 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 wifi: ath9k: fix OOB access from firmware tx status queue ID

From: Tristan Madani <[email protected]>

ath_tx_edma_tasklet() accesses sc->tx.txq[ts.qid] where ts.qid is a 4-bit hardware field (0-15), but the txq array only has ATH9K_NUM_TX_QUEUES (10) entries. A qid >= 10 causes an OOB array access.

Add a bounds check on ts.qid before using it as an array index.

Fixes fce041beb03f ("ath9k: unify edma and non-edma tx code, improve tx fifo handling")

---
Note: v2 resubmission -- original sent via Gmail had HTML rendering issues. This version uses git send-email for plain-text formatting.

drivers/net/wireless/ath/ath9k/xmit.c | 5 +++++

 1 file changed, 5 insertions(+)
drivers/net/wireless/ath/ath9k/xmit.c +5 -0
index XXXXXXX..XXXXXXX 100644
@@ -2755,6 +2755,11 @@ static void ath_tx_edma_tasklet(struct ath_softc *sc)
 			continue;
 		}
 
+		if (ts.qid >= ATH9K_NUM_TX_QUEUES) {
+			ath_dbg(common, XMIT, "invalid qid %d\n", ts.qid);
+			continue;
+		}
+
 		txq = &sc->tx.txq[ts.qid];
 
 		ath_txq_lock(sc, txq);

--
2.43.0

maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 11 lines · Tristan Madani

From: Tristan Madani <[email protected]>

ath_tx_edma_tasklet() accesses sc->tx.txq[ts.qid] where ts.qid is a 4-bit hardware field (0-15), but the txq array only has ATH9K_NUM_TX_QUEUES (10) entries. A qid >= 10 causes an OOB array access.

Add a bounds check on ts.qid before using it as an array index.

Fixes fce041beb03f ("ath9k: unify edma and non-edma tx code, improve tx fifo handling")
Applied
#2 lore raw
In reply to Tristan Madani
Quoted 8 lines · Tristan Madani

ath_tx_edma_tasklet() accesses sc->tx.txq[ts.qid] where ts.qid is a 4-bit hardware field (0-15), but the txq array only has ATH9K_NUM_TX_QUEUES (10) entries. A qid >= 10 causes an OOB array access.

Add a bounds check on ts.qid before using it as an array index.

[...]

Applied, thanks!

[1/1] wifi: ath9k: fix OOB access from firmware tx status queue ID

      commit: 7ce2f118a2389e8f0a64068c6fe7cc7d40639be0

Best regards,

Signature · 1 line
Jeff Johnson <[email protected]>
#4 lore raw
Quoted 6 lines · Tristan Madani

Thanks for applying, Jeff.

Would you mind adding a Reported-by tag as well? I am both the finder and the fixer:

Unfortunately that is a public immutable branch so the commit can no longer be modified.

/jeff