]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
wifi: mt76: mt7996: use hweight16 to get correct tx antenna
authorPeter Chiu <chui-hao.chiu@mediatek.com>
Fri, 16 Aug 2024 09:46:25 +0000 (17:46 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:28:55 +0000 (16:28 +0200)
commit50d87e3b70980abc090676b6b4703fcbd96221f9
treeea0515e37212d6e9fae283727ccf18cce642afed
parent818dd118f4a997f8b4fe9c010b22402d410a2424
wifi: mt76: mt7996: use hweight16 to get correct tx antenna

[ Upstream commit f98c3de92bb05dac4a4969df8a4595ed380b4604 ]

The chainmask is u16 so using hweight8 cannot get correct tx_ant.
Without this patch, the tx_ant of band 2 would be -1 and lead to the
following issue:
BUG: KASAN: stack-out-of-bounds in mt7996_mcu_add_sta+0x12e0/0x16e0 [mt7996e]

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>
Link: https://patch.msgid.link/20240816094635.2391-1-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