Skip to content

Commit 2705cd7

Browse files
Dan CarpenterKalle Valo
authored andcommitted
ath9k: Fix potential out of bounds in ath9k_htc_txcompletion_cb()
The value of "htc_hdr->endpoint_id" comes from skb->data so Smatch marks it as untrusted so we have to check it before using it as an array offset. This is similar to a bug that syzkaller found in commit e4ff08a ("ath9k: Fix use-after-free Write in ath9k_htc_rx_msg") so it is probably a real issue. Fixes: fb9987d ("ath9k_htc: Support for AR9271 chipset.") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/20200813141253.GA457408@mwanda
1 parent 5024f21 commit 2705cd7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle,
339339

340340
if (skb) {
341341
htc_hdr = (struct htc_frame_hdr *) skb->data;
342+
if (htc_hdr->endpoint_id >= ARRAY_SIZE(htc_handle->endpoint))
343+
goto ret;
342344
endpoint = &htc_handle->endpoint[htc_hdr->endpoint_id];
343345
skb_pull(skb, sizeof(struct htc_frame_hdr));
344346

0 commit comments

Comments
 (0)