From: Ming Yen Hsieh Date: Mon, 19 Aug 2024 01:53:33 +0000 (+0800) Subject: wifi: mt76: mt7925: fix a potential array-index-out-of-bounds issue for clc X-Git-Tag: v6.12-rc1~232^2~41^2~1^2~1 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=9679ca7326e5;p=linux-block.git wifi: mt76: mt7925: fix a potential array-index-out-of-bounds issue for clc Due to the lack of checks on the clc array, if the firmware supports more clc configuration, it will cause illegal memory access. Cc: stable@vger.kernel.org Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips") Signed-off-by: Ming Yen Hsieh Link: https://patch.msgid.link/20240819015334.14580-1-mingyen.hsieh@mediatek.com Signed-off-by: Felix Fietkau --- diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index e07b43dd8638..748ea6adbc6b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -638,6 +638,9 @@ static int mt7925_load_clc(struct mt792x_dev *dev, const char *fw_name) for (offset = 0; offset < len; offset += le32_to_cpu(clc->len)) { clc = (const struct mt7925_clc *)(clc_base + offset); + if (clc->idx > ARRAY_SIZE(phy->clc)) + break; + /* do not init buf again if chip reset triggered */ if (phy->clc[clc->idx]) continue;