Skip to content

Commit 2adc886

Browse files
minskMedvekvalo
authored andcommitted
wifi: ath9k: Fix potential array-index-out-of-bounds read in ath9k_htc_txstatus()
Fix an array-index-out-of-bounds read in ath9k_htc_txstatus(). The bug occurs when txs->cnt, data from a URB provided by a USB device, is bigger than the size of the array txs->txstatus, which is HTC_MAX_TX_STATUS. WARN_ON() already checks it, but there is no bug handling code after the check. Make the function return if that is the case. Found by a modified version of syzkaller. UBSAN: array-index-out-of-bounds in htc_drv_txrx.c index 13 is out of range for type '__wmi_event_txstatus [12]' Call Trace: ath9k_htc_txstatus ath9k_wmi_event_tasklet tasklet_action_common __do_softirq irq_exit_rxu sysvec_apic_timer_interrupt Signed-off-by: Minsuk Kang <[email protected]> Acked-by: Toke Høiland-Jørgensen <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent d6e71dd commit 2adc886

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/net/wireless/ath/ath9k/htc_drv_txrx.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,9 +652,10 @@ void ath9k_htc_txstatus(struct ath9k_htc_priv *priv, void *wmi_event)
652652
struct ath9k_htc_tx_event *tx_pend;
653653
int i;
654654

655-
for (i = 0; i < txs->cnt; i++) {
656-
WARN_ON(txs->cnt > HTC_MAX_TX_STATUS);
655+
if (WARN_ON_ONCE(txs->cnt > HTC_MAX_TX_STATUS))
656+
return;
657657

658+
for (i = 0; i < txs->cnt; i++) {
658659
__txs = &txs->txstatus[i];
659660

660661
skb = ath9k_htc_tx_get_packet(priv, __txs);

0 commit comments

Comments
 (0)