Skip to content

Commit 7e8df8f

Browse files
Quanzhoucengregkh
authored andcommitted
wifi: mt76: mt7925: fix incorrect TLV length in CLC command
commit 62e037a upstream. The previous implementation of __mt7925_mcu_set_clc() set the TLV length field (.len) incorrectly during CLC command construction. The length was initialized as sizeof(req) - 4, regardless of the actual segment length. This could cause the WiFi firmware to misinterpret the command payload, resulting in command execution errors. This patch moves the TLV length assignment to after the segment is selected, and sets .len to sizeof(req) + seg->len - 4, matching the actual command content. This ensures the firmware receives the correct TLV length and parses the command properly. Fixes: c948b5d ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips") Cc: stable@vger.kernel.org Signed-off-by: Quan Zhou <quan.zhou@mediatek.com> Acked-by: Sean Wang <sean.wang@mediatek.com> Link: https://patch.msgid.link/f56ae0e705774dfa8aab3b99e5bbdc92cd93523e.1772011204.git.quan.zhou@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4f42dd0 commit 7e8df8f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • drivers/net/wireless/mediatek/mt76/mt7925

drivers/net/wireless/mediatek/mt76/mt7925/mcu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3375,7 +3375,6 @@ __mt7925_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2,
33753375
u8 rsvd[64];
33763376
} __packed req = {
33773377
.tag = cpu_to_le16(0x3),
3378-
.len = cpu_to_le16(sizeof(req) - 4),
33793378

33803379
.idx = idx,
33813380
.env = env_cap,
@@ -3404,6 +3403,7 @@ __mt7925_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2,
34043403
memcpy(req.type, rule->type, 2);
34053404

34063405
req.size = cpu_to_le16(seg->len);
3406+
req.len = cpu_to_le16(sizeof(req) + seg->len - 4);
34073407
dev->phy.clc_chan_conf = clc->ver == 1 ? 0xff : rule->flag;
34083408
skb = __mt76_mcu_msg_alloc(&dev->mt76, &req,
34093409
le16_to_cpu(req.size) + sizeof(req),

0 commit comments

Comments
 (0)