]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: mt76: mt7996: add missing check for rx wcid entries
authorFelix Fietkau <nbd@nbd.name>
Wed, 27 Aug 2025 08:53:49 +0000 (10:53 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Sep 2025 17:02:19 +0000 (19:02 +0200)
[ Upstream commit 4a522b01e368eec58d182ecc47d24f49a39e440d ]

Non-station wcid entries must not be passed to the rx functions.
In case of the global wcid entry, it could even lead to corruption in the wcid
array due to pointer being casted to struct mt7996_sta_link using container_of.

Fixes: 7464b12b7d92 ("wifi: mt76: mt7996: rework mt7996_rx_get_wcid to support MLO")
Link: https://patch.msgid.link/20250827085352.51636-3-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/mediatek/mt76/mt7996/mac.c

index b0fa051fc30941d459c1fa0c6042e4b5e7198620..a7a5ac8b7d265941f8f7fa2df9e8c79622d39dc3 100644 (file)
@@ -62,7 +62,7 @@ static struct mt76_wcid *mt7996_rx_get_wcid(struct mt7996_dev *dev,
        int i;
 
        wcid = mt76_wcid_ptr(dev, idx);
-       if (!wcid)
+       if (!wcid || !wcid->sta)
                return NULL;
 
        if (!mt7996_band_valid(dev, band_idx))