Skip to content

Commit

Permalink
ath9k_htc: fix potential out of bounds access with invalid rxstatus->…
Browse files Browse the repository at this point in the history
…rs_keyix

[ Upstream commit 2dc5093 ]

The "rxstatus->rs_keyix" eventually gets passed to test_bit() so we need to
ensure that it is within the bitmap.

drivers/net/wireless/ath/ath9k/common.c:46 ath9k_cmn_rx_accept()
error: passing untrusted data 'rx_stats->rs_keyix' to 'test_bit()'

Fixes: 4ed1a8d ("ath9k_htc: use ath9k_cmn_rx_accept")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20220409061225.GA5447@kili
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Dan Carpenter authored and gregkh committed Jun 9, 2022
1 parent 96c848a commit 461e4c1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,14 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv,
goto rx_next;
}

if (rxstatus->rs_keyix >= ATH_KEYMAX &&
rxstatus->rs_keyix != ATH9K_RXKEYIX_INVALID) {
ath_dbg(common, ANY,
"Invalid keyix, dropping (keyix: %d)\n",
rxstatus->rs_keyix);
goto rx_next;
}

/* Get the RX status information */

memset(rx_status, 0, sizeof(struct ieee80211_rx_status));
Expand Down

0 comments on commit 461e4c1

Please sign in to comment.