Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH] wifi: ath9k: validate skb length in USB HIF rx reassembly
@ 2026-11-30 21:24 Tanuj Sharma
  0 siblings, 0 replies; only message in thread
From: Tanuj Sharma @ 2026-11-30 21:24 UTC (permalink / raw)
  To: toke; +Cc: kvalo, linux-wireless, stable

In ath9k_hif_usb_rx_stream(), when resuming a partial packet from a
prior USB transfer, rx_remain_len bytes are copied from the current skb
without checking that skb->len >= rx_remain_len. A short USB transfer
following a large packet header causes memcpy to read past the skb data
into adjacent slab memory.

Add a bounds check before the reassembly memcpy to ensure the current
skb has enough data. If not, discard the partial packet and return.

Fixes: fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.")
Cc: stable@vger.kernel.org
Signed-off-by: Tanuj Sharma <ertanuj96@gmail.com>
---
 drivers/net/wireless/ath/ath9k/hif_usb.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index 7d2f292..79396ac 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -570,6 +570,14 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
 
 			index = rx_remain_len;
 			rx_remain_len -= hif_dev->rx_pad_len;
+
+			if (skb->len < rx_remain_len) {
+				dev_kfree_skb_any(hif_dev->remain_skb);
+				hif_dev->remain_skb = NULL;
+				hif_dev->rx_remain_len = 0;
+				spin_unlock(&hif_dev->rx_lock);
+				return;
+			}
 			ptr += rx_pkt_len;
 
 			memcpy(ptr, skb->data, rx_remain_len);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-30 21:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 21:24 [PATCH] wifi: ath9k: validate skb length in USB HIF rx reassembly Tanuj Sharma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox