Linux wireless drivers development
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH mt76-next 05/11] wifi: mt76: mt7996: validate radar, thermal and WED RRO event lengths
Date: Sat, 24 Oct 2026 09:19:21 +0200	[thread overview]
Message-ID: <20261024071927.2279668-5-nbd@nbd.name> (raw)
In-Reply-To: <20261024071927.2279668-1-nbd@nbd.name>

mt7996_mcu_rx_event() only guarantees the receive descriptor fields
used for dispatch. mt7996_mcu_rx_radar_detected(),
mt7996_mcu_rx_thermal_notify() and mt7996_mcu_wed_rro_event() then read
event fields after the descriptor without checking the event length. A
truncated event causes an out-of-bounds read.

Ignore events too short for the fields the handler reads, like the
other unsolicited event handlers do.

Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Fixes: 21f290884bc1 ("wifi: mt76: connac: add thermal protection support for mt7996")
Fixes: a5d028d66836 ("wifi: mt76: mt7996: add wed rro delete session garbage collector")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
index 9037520183f4..590931207d79 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
@@ -544,6 +544,9 @@ mt7996_mcu_rx_radar_detected(struct mt7996_dev *dev, struct sk_buff *skb)
 	struct mt76_phy *mphy = &dev->mt76.phy;
 	struct mt7996_mcu_rdd_report *r;
 
+	if (skb->len < offsetofend(struct mt7996_mcu_rdd_report, rdd_idx))
+		return;
+
 	r = (struct mt7996_mcu_rdd_report *)skb->data;
 
 	switch (r->rdd_idx) {
@@ -763,6 +766,10 @@ mt7996_mcu_rx_thermal_notify(struct mt7996_dev *dev, struct sk_buff *skb)
 	struct mt7996_mcu_thermal_notify *n;
 	struct mt7996_phy *phy;
 
+	if (skb->len < offsetofend(struct mt7996_mcu_thermal_notify,
+				   duty_percent))
+		return;
+
 	n = (struct mt7996_mcu_thermal_notify *)skb->data;
 
 	if (le16_to_cpu(n->tag) != THERMAL_NOTIFY_TAG)
@@ -819,7 +826,7 @@ mt7996_mcu_wed_rro_event(struct mt7996_dev *dev, struct sk_buff *skb)
 {
 	struct mt7996_mcu_wed_rro_event *event = (void *)skb->data;
 
-	if (!mt7996_has_hwrro(dev))
+	if (!mt7996_has_hwrro(dev) || skb->len < sizeof(*event))
 		return;
 
 	skb_pull(skb, sizeof(struct mt7996_mcu_rxd) + 4);
-- 
2.47.3


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

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-24  7:19 [PATCH mt76-next 01/11] wifi: mt76: mt7921: validate CLC event length Felix Fietkau
2026-10-24  7:19 ` [PATCH mt76-next 02/11] wifi: mt76: mt7921: validate NIC capability TLV payload lengths Felix Fietkau
2026-10-24  7:19 ` [PATCH mt76-next 03/11] wifi: mt76: mt7925: validate NIC capability TLV lengths Felix Fietkau
2026-10-24  7:19 ` [PATCH mt76-next 04/11] wifi: mt76: mt7925: free the MCU event when linearising fails Felix Fietkau
2026-10-24  7:19 ` Felix Fietkau [this message]
2026-10-24  7:19 ` [PATCH mt76-next 06/11] wifi: mt76: connac: validate the RAM firmware region table Felix Fietkau
2026-10-24  7:19 ` [PATCH mt76-next 07/11] wifi: mt76: mt7996: " Felix Fietkau
2026-10-24  7:19 ` [PATCH mt76-next 08/11] wifi: mt76: mt7925: validate CLC firmware regions and records Felix Fietkau
2026-10-24  7:19 ` [PATCH mt76-next 09/11] wifi: mt76: connac: validate the ROM patch section table Felix Fietkau
2026-10-24  7:19 ` [PATCH mt76-next 10/11] wifi: mt76: mt7996: " Felix Fietkau
2026-10-24  7:19 ` [PATCH mt76-next 11/11] wifi: mt76: mt792x: use mt76_connac2_fw_check() Felix Fietkau

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=20261024071927.2279668-5-nbd@nbd.name \
    --to=nbd@nbd.name \
    --cc=linux-wireless@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