Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Tanuj Sharma <ertanuj96@gmail.com>
To: jjohnson@kernel.org
Cc: kvalo@kernel.org, linux-wireless@vger.kernel.org,
	ath10k@lists.infradead.org, stable@vger.kernel.org
Subject: [PATCH] wifi: ath10k: validate skb length for WMI mgmt rx ext_info
Date: Tue,  1 Dec 2026 02:54:00 +0530	[thread overview]
Message-ID: <20261130212400.85543-1-ertanuj96@gmail.com> (raw)

When the WMI_RX_STATUS_EXT_INFO flag is set in a management frame rx
event, ath10k reads sizeof(struct wmi_mgmt_rx_ext_info) (8 bytes)
starting at ALIGN(msdu_len, 4) from the skb. However, the bounds check
only validates that skb->len >= msdu_len, not that the skb is large
enough for the aligned offset plus the ext_info struct.

If msdu_len is close to skb->len (e.g., msdu_len=99, skb->len=99),
ALIGN(99, 4)=100, and the 8-byte ext_info read accesses bytes
[100..107], up to 9 bytes past the validated region.

Add a bounds check ensuring skb->len is large enough for the aligned
buffer length plus the ext_info struct before accessing it. Both
ath10k_wmi_op_pull_mgmt_rx_ev() and ath10k_wmi_10_4_op_pull_mgmt_rx_ev()
are fixed.

Fixes: 7d5efd088833 ("ath10k: parse Rx MAC timestamp in mgmt frame for FW 10.4")
Cc: stable@vger.kernel.org
Signed-off-by: Tanuj Sharma <ertanuj96@gmail.com>
---
 drivers/net/wireless/ath/ath10k/wmi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index e57588c..91142ab 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2346,6 +2346,8 @@ static int ath10k_wmi_op_pull_mgmt_rx_ev(struct ath10k *ar, struct sk_buff *skb,
 
 	if (le32_to_cpu(arg->status) & WMI_RX_STATUS_EXT_INFO) {
 		len = ALIGN(le32_to_cpu(arg->buf_len), 4);
+		if (skb->len < len + sizeof(struct wmi_mgmt_rx_ext_info))
+			return -EPROTO;
 		ext_info = (struct wmi_mgmt_rx_ext_info *)(skb->data + len);
 		memcpy(&arg->ext_info, ext_info,
 		       sizeof(struct wmi_mgmt_rx_ext_info));
@@ -2390,6 +2392,8 @@ static int ath10k_wmi_10_4_op_pull_mgmt_rx_ev(struct ath10k *ar,
 
 	if (le32_to_cpu(arg->status) & WMI_RX_STATUS_EXT_INFO) {
 		len = ALIGN(le32_to_cpu(arg->buf_len), 4);
+		if (skb->len < len + sizeof(struct wmi_mgmt_rx_ext_info))
+			return -EPROTO;
 		ext_info = (struct wmi_mgmt_rx_ext_info *)(skb->data + len);
 		memcpy(&arg->ext_info, ext_info,
 		       sizeof(struct wmi_mgmt_rx_ext_info));
-- 
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=20261130212400.85543-1-ertanuj96@gmail.com \
    --to=ertanuj96@gmail.com \
    --cc=ath10k@lists.infradead.org \
    --cc=jjohnson@kernel.org \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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