mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiale Yao <yaojiale02@163.com>
To: Jeff Johnson <jjohnson@kernel.org>,
	Carl Huang <quic_cjhuang@quicinc.com>,
	Kalle Valo <kvalo@kernel.org>,
	Bhagavathi Perumal S <quic_bperumal@quicinc.com>,
	P Praneesh <quic_ppranees@quicinc.com>,
	Balamurugan Selvarajan <quic_bselvara@quicinc.com>,
	linux-wireless@vger.kernel.org, ath12k@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: Jiale Yao <jiale.yao@example.com>
Subject: [PATCH 4/4] wifi: ath12k: validate ready event MAC address array length
Date: Mon, 19 Oct 2026 18:00:29 +0800	[thread overview]
Message-ID: <20261019100029.1908660-5-yaojiale02@163.com> (raw)
In-Reply-To: <20261019100029.1908660-1-yaojiale02@163.com>

From: Jiale Yao <jiale.yao@example.com>

The ready event reports the number of extra MAC addresses separately
from the fixed-structure address array. ath12k checks the reported
count before assigning addresses to radios, but does not check the
length of the array TLV. A truncated array therefore causes reads past
the supplied event data.

Validate the array capacity before copying any addresses.

Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
Signed-off-by: Jiale Yao <jiale.yao@example.com>
---
 drivers/net/wireless/ath/ath12k/wmi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c
index 66e39672dcda..0ae366e8a944 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.c
+++ b/drivers/net/wireless/ath/ath12k/wmi.c
@@ -7082,6 +7082,9 @@ static int ath12k_wmi_rdy_parse(struct ath12k_base *ab, u16 tag, u16 len,
 		if (!(ab->num_radios > 1 && num_mac_addr >= ab->num_radios))
 			break;
 
+		if (len / sizeof(*addr_list) < ab->num_radios)
+			return -EINVAL;
+
 		for (i = 0; i < ab->num_radios; i++) {
 			pdev = &ab->pdevs[i];
 			ether_addr_copy(pdev->mac_addr, addr_list[i].addr);
-- 
2.34.1


  parent reply	other threads:[~2026-10-19 10:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 10:00 [PATCH 0/4] wifi: ath11k/ath12k: validate firmware array lengths Jiale Yao
2026-10-19 10:00 ` [PATCH 1/4] wifi: ath11k: validate extended regulatory capability count Jiale Yao
2026-10-19 10:00 ` [PATCH 2/4] wifi: ath12k: " Jiale Yao
2026-10-19 10:00 ` [PATCH 3/4] wifi: ath11k: validate ready event MAC address array length Jiale Yao
2026-10-19 10:00 ` Jiale Yao [this message]
2026-10-19 10:05 [PATCH 0/4] wifi: ath11k/ath12k: validate firmware array lengths Jiale Yao
2026-10-19 10:05 ` [PATCH 4/4] wifi: ath12k: validate ready event MAC address array length Jiale Yao

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=20261019100029.1908660-5-yaojiale02@163.com \
    --to=yaojiale02@163.com \
    --cc=ath12k@lists.infradead.org \
    --cc=jiale.yao@example.com \
    --cc=jjohnson@kernel.org \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=quic_bperumal@quicinc.com \
    --cc=quic_bselvara@quicinc.com \
    --cc=quic_cjhuang@quicinc.com \
    --cc=quic_ppranees@quicinc.com \
    /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

all inboxes | Powered by JetHome®