linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/12] wifi: mt76: mt7996: use hweight16 to get correct tx antenna
@ 2024-08-16  9:46 Shayne Chen
  2024-08-16  9:46 ` [PATCH 02/12] wifi: mt76: mt7996: fix traffic delay when switching back to working channel Shayne Chen
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: Shayne Chen @ 2024-08-16  9:46 UTC (permalink / raw)
  To: Felix Fietkau
  Cc: linux-wireless, Lorenzo Bianconi, Ryder Lee, Evelyn Tsai,
	linux-mediatek, Peter Chiu, Shayne Chen

From: Peter Chiu <chui-hao.chiu@mediatek.com>

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>
---
 drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
index 2e4fa9f48dfb..e68724e54013 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
@@ -1653,7 +1653,7 @@ mt7996_mcu_sta_bfer_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
 {
 	struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
 	struct mt7996_phy *phy = mvif->phy;
-	int tx_ant = hweight8(phy->mt76->chainmask) - 1;
+	int tx_ant = hweight16(phy->mt76->chainmask) - 1;
 	struct sta_rec_bf *bf;
 	struct tlv *tlv;
 	static const u8 matrix[4][4] = {
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-08-20 10:24 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-16  9:46 [PATCH 01/12] wifi: mt76: mt7996: use hweight16 to get correct tx antenna Shayne Chen
2024-08-16  9:46 ` [PATCH 02/12] wifi: mt76: mt7996: fix traffic delay when switching back to working channel Shayne Chen
2024-08-16  9:46 ` [PATCH 03/12] wifi: mt76: mt7996: fix wmm set of station interface to 3 Shayne Chen
2024-08-16  9:46 ` [PATCH 05/12] wifi: mt76: mt7996: advertize beacon_int_min_gcd Shayne Chen
2024-08-16  9:46 ` [PATCH 06/12] wifi: mt76: mt7996: fix HE and EHT beamforming capabilities Shayne Chen
2024-08-16  9:46 ` [PATCH 07/12] wifi: mt76: mt7996: set correct beamformee SS capability Shayne Chen
2024-08-19 14:22   ` Ben Greear
2024-08-20 10:23     ` shayne.chen
2024-08-16  9:46 ` [PATCH 08/12] wifi: mt76: mt7996: fix EHT beamforming capability check Shayne Chen
2024-08-16  9:46 ` [PATCH 09/12] wifi: mt76: mt7996: set correct value in beamforming mcu command for mt7992 Shayne Chen
2024-08-16  9:46 ` [PATCH 10/12] wifi: mt76: mt7996: fix handling mbss enable/disable Shayne Chen
2024-08-16  9:46 ` [PATCH 11/12] wifi: mt76: connac: add IEEE 802.11 fragmentation support for mt7996 Shayne Chen
2024-08-16  9:46 ` [PATCH 12/12] wifi: mt76: mt7996: set IEEE80211_KEY_FLAG_GENERATE_MMIE for other ciphers Shayne Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).