From: Jiale Yao <yaojiale02@163.com>
To: Felix Fietkau <nbd@nbd.name>,
Lorenzo Bianconi <lorenzo@kernel.org>,
Ryder Lee <ryder.lee@mediatek.com>,
Shayne Chen <shayne.chen@mediatek.com>,
Sean Wang <sean.wang@mediatek.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
YF Luo <yf.luo@mediatek.com>,
Yiwei Chung <yiwei.chung@mediatek.com>,
Chih-Min Chen <chih-min.chen@mediatek.com>,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Cc: Jiale Yao <yaojiale02@163.com>
Subject: [PATCH 03/10] wifi: mt76: mt7915: validate MCU response lengths
Date: Mon, 19 Oct 2026 18:14:58 +0800 [thread overview]
Message-ID: <20261019101506.1926943-4-yaojiale02@163.com> (raw)
In-Reply-To: <20261019101506.1926943-1-yaojiale02@163.com>
The MCU response parser accesses receive descriptor fields and some
command payloads without checking their lengths. A truncated firmware
response can therefore cause an out-of-bounds read.
Validate the descriptor and the patch semaphore and thermal payloads
before accessing them.
Fixes: e57b7901469f ("mt76: add mac80211 driver for MT7915 PCIe-based chipsets")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
index 5bfe0366562f..3643906cbdf2 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
@@ -174,6 +174,11 @@ mt7915_mcu_parse_response(struct mt76_dev *mdev, int cmd,
return -ETIMEDOUT;
}
+ if (cmd == MCU_CMD(PATCH_SEM_CONTROL) &&
+ skb->len < sizeof(*rxd) - 4 + sizeof(u8))
+ return -EINVAL;
+ if (cmd != MCU_CMD(PATCH_SEM_CONTROL) && skb->len < sizeof(*rxd))
+ return -EINVAL;
rxd = (struct mt76_connac2_mcu_rxd *)skb->data;
if (seq != rxd->seq &&
@@ -185,6 +190,9 @@ mt7915_mcu_parse_response(struct mt76_dev *mdev, int cmd,
skb_pull(skb, sizeof(*rxd) - 4);
ret = *skb->data;
} else if (cmd == MCU_EXT_CMD(THERMAL_CTRL)) {
+ if (skb->len < sizeof(*rxd) + 4 + sizeof(__le32))
+ return -EINVAL;
+
skb_pull(skb, sizeof(*rxd) + 4);
ret = le32_to_cpu(*(__le32 *)skb->data);
} else {
--
2.34.1
next prev parent reply other threads:[~2026-10-19 10:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 10:14 [PATCH 00/10] wifi: mt76: validate legacy MCU responses Jiale Yao
2026-10-19 10:14 ` [PATCH 01/10] wifi: mt76: mt7603: validate MCU response length Jiale Yao
2026-10-19 10:14 ` [PATCH 02/10] wifi: mt76: mt7615: validate MCU response lengths Jiale Yao
2026-10-19 10:14 ` Jiale Yao [this message]
2026-10-19 10:14 ` [PATCH 04/10] wifi: mt76: mt7915: validate MURU statistics response Jiale Yao
2026-10-19 10:15 ` [PATCH 05/10] wifi: mt76: mt7915: validate EEPROM response length Jiale Yao
2026-10-19 10:15 ` [PATCH 06/10] wifi: mt76: mt7915: validate free-block " Jiale Yao
2026-10-19 10:15 ` [PATCH 07/10] wifi: mt76: mt7915: validate channel MIB " Jiale Yao
2026-10-19 10:15 ` [PATCH 08/10] wifi: mt76: mt7915: validate RX rate " Jiale Yao
2026-10-19 10:15 ` [PATCH 09/10] wifi: mt76: mt7915: validate WED TX statistics response Jiale Yao
2026-10-20 2:23 ` [PATCH 10/10] wifi: mt76: mt7915: validate RF register response 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=20261019101506.1926943-4-yaojiale02@163.com \
--to=yaojiale02@163.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chih-min.chen@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=nbd@nbd.name \
--cc=ryder.lee@mediatek.com \
--cc=sean.wang@mediatek.com \
--cc=shayne.chen@mediatek.com \
--cc=yf.luo@mediatek.com \
--cc=yiwei.chung@mediatek.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