Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Tanuj Sharma <ertanuj96@gmail.com>
To: toke@toke.dk
Cc: kvalo@kernel.org, linux-wireless@vger.kernel.org, stable@vger.kernel.org
Subject: [PATCH] wifi: ath9k: validate skb length in USB HIF rx reassembly
Date: Tue,  1 Dec 2026 02:54:14 +0530	[thread overview]
Message-ID: <20261130212414.85571-1-ertanuj96@gmail.com> (raw)

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


                 reply	other threads:[~2026-11-30 21:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261130212414.85571-1-ertanuj96@gmail.com \
    --to=ertanuj96@gmail.com \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=toke@toke.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox