]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: mt76: mt7996: fix pointer calculation in ie countdown event
authorPeter Chiu <chui-hao.chiu@mediatek.com>
Fri, 3 Mar 2023 08:35:55 +0000 (16:35 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:11:16 +0000 (23:11 +0900)
[ Upstream commit 8b14ce24a0297175bc4ebdf26d45a22b5a33847f ]

Fix the tail and data pointers. The rxd->len in mt7996_mcu_rxd does not
include the length of general rxd. It only includes the length of
firmware event rxd. Use skb->length to get the correct length.

Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c

index 18c4e7bc4370d9d8d67c74994aec1d126ed45758..c8c332ed8a402696748098e650434cb45c5dcb2a 100644 (file)
@@ -421,7 +421,8 @@ mt7996_mcu_ie_countdown(struct mt7996_dev *dev, struct sk_buff *skb)
        if (hdr->band && dev->mt76.phys[hdr->band])
                mphy = dev->mt76.phys[hdr->band];
 
-       tail = skb->data + le16_to_cpu(rxd->len);
+       tail = skb->data + skb->len;
+       data += sizeof(struct header);
        while (data + sizeof(struct tlv) < tail && le16_to_cpu(tlv->len)) {
                switch (le16_to_cpu(tlv->tag)) {
                case UNI_EVENT_IE_COUNTDOWN_CSA: