]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: mt76: mt7925: fix a potential array-index-out-of-bounds issue for clc
authorMing Yen Hsieh <mingyen.hsieh@mediatek.com>
Mon, 19 Aug 2024 01:53:33 +0000 (09:53 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:38:45 +0000 (16:38 +0200)
commit 9679ca7326e52282cc923c4d71d81c999cb6cd55 upstream.

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 <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20240819015334.14580-1-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c

index 9dc22fbe25d3350875874f55d9d8ee8b384a1789..c6c380571fd86f34a727b67b7839e7186e68b988 100644 (file)
@@ -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;