]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: mt76: mt7925: fix possible NULL-pointer deref in mt7925_mcu_bss_he_tlv()
authorLorenzo Bianconi <lorenzo@kernel.org>
Sun, 21 Jun 2026 13:25:00 +0000 (15:25 +0200)
committerFelix Fietkau <nbd@nbd.name>
Wed, 22 Jul 2026 06:10:56 +0000 (06:10 +0000)
mt76_connac_get_he_phy_cap routine can theoretically return NULL so
check cap pointer before dereferencing it.

Fixes: c948b5da6bbec ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20260621-mt76_connac_get_he_phy_cap-fix-v1-2-ed4ccf7a0363@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c

index e94fa544ff20779ac9cf3be93692f7233b8478c9..cb265a6fc7adbdf12ee923f2d218e096a50d7466 100644 (file)
@@ -2773,6 +2773,8 @@ mt7925_mcu_bss_he_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *link_conf,
        struct tlv *tlv;
 
        cap = mt76_connac_get_he_phy_cap(phy->mt76, link_conf->vif);
+       if (!cap)
+               return;
 
        tlv = mt76_connac_mcu_add_tlv(skb, UNI_BSS_INFO_HE_BASIC, sizeof(*he));