Skip to content

Commit 0ec4926

Browse files
Quanzhoucenopsiff
authored andcommitted
wifi: mt76: mt7925: fix incorrect TLV length in CLC command
[ Upstream commit 62e037aa8cf5a69b7ea63336705a35c897b9db2b ] 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: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 113c0650ce7d81608eca7b2a0e539208102d0622) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent 4711deb commit 0ec4926

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
@@ -3201,7 +3201,6 @@ __mt7925_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2,
32013201
u8 rsvd[64];
32023202
} __packed req = {
32033203
.tag = cpu_to_le16(0x3),
3204-
.len = cpu_to_le16(sizeof(req) - 4),
32053204

32063205
.idx = idx,
32073206
.env = env_cap,
@@ -3229,6 +3228,7 @@ __mt7925_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2,
32293228
memcpy(req.type, rule->type, 2);
32303229

32313230
req.size = cpu_to_le16(seg->len);
3231+
req.len = cpu_to_le16(sizeof(req) + seg->len - 4);
32323232
skb = __mt76_mcu_msg_alloc(&dev->mt76, &req,
32333233
le16_to_cpu(req.size) + sizeof(req),
32343234
sizeof(req), GFP_KERNEL);

0 commit comments

Comments
 (0)