Skip to content

Commit a011184

Browse files
leon-yengregkh
authored andcommitted
wifi: mt76: mt7921: fix a potential clc buffer length underflow
commit 5373f8b upstream. The buf_len is used to limit the iterations for retrieving the country power setting and may underflow under certain conditions due to changes in the power table in CLC. This underflow leads to an almost infinite loop or an invalid power setting resulting in driver initialization failure. Cc: stable@vger.kernel.org Fixes: fa6ad88 ("wifi: mt76: mt7921: fix country count limitation for CLC") Signed-off-by: Leon Yen <leon.yen@mediatek.com> Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Link: https://patch.msgid.link/20251009020158.1923429-1-mingyen.hsieh@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e8ad4f3 commit a011184

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • drivers/net/wireless/mediatek/mt76/mt7921

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,6 +1353,9 @@ int __mt7921_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2,
13531353
u16 len = le16_to_cpu(rule->len);
13541354
u16 offset = len + sizeof(*rule);
13551355

1356+
if (buf_len < offset)
1357+
break;
1358+
13561359
pos += offset;
13571360
buf_len -= offset;
13581361
if (rule->alpha2[0] != alpha2[0] ||

0 commit comments

Comments
 (0)