]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: mt76: mt7925: Fix possible oob access in mt7925_mac_write_txwi_80211()
authorLorenzo Bianconi <lorenzo@kernel.org>
Thu, 26 Feb 2026 19:11:15 +0000 (20:11 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 3 Mar 2026 11:09:45 +0000 (12:09 +0100)
Check frame length before accessing the mgmt fields in
mt7925_mac_write_txwi_80211 in order to avoid a possible oob access.

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/20260226-mt76-addba-req-oob-access-v1-2-b0f6d1ad4850@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/mediatek/mt76/mt7925/mac.c

index 871b67101976a7d72ca10c9736ccfa59b0f21122..0d94359004233e94c11a2d09f67b1ae61ccf71ad 100644 (file)
@@ -668,6 +668,7 @@ mt7925_mac_write_txwi_80211(struct mt76_dev *dev, __le32 *txwi,
        u32 val;
 
        if (ieee80211_is_action(fc) &&
+           skb->len >= IEEE80211_MIN_ACTION_SIZE + 1 &&
            mgmt->u.action.category == WLAN_CATEGORY_BACK &&
            mgmt->u.action.u.addba_req.action_code == WLAN_ACTION_ADDBA_REQ)
                tid = MT_TX_ADDBA;