linux/drivers/net/wireless
Sascha Hauer 20a1064a75 wifi: rtw88: rtw8821c: Fix rfe_option field width
[ Upstream commit 14705f969d ]

On my RTW8821CU chipset rfe_option reads as 0x22. Looking at the
vendor driver suggests that the field width of rfe_option is 5 bit,
so rfe_option should be masked with 0x1f.

Without this the rfe_option comparisons with 2 further down the
driver evaluate as false when they should really evaluate as true.
The effect is that 2G channels do not work.

rfe_option is also used as an array index into rtw8821c_rfe_defs[].
rtw8821c_rfe_defs[34] (0x22) was added as part of adding USB support,
likely because rfe_option reads as 0x22. As this now becomes 0x2,
rtw8821c_rfe_defs[34] is no longer used and can be removed.

Note that this might not be the whole truth. In the vendor driver
there are indeed places where the unmasked rfe_option value is used.
However, the driver has several places where rfe_option is tested
with the pattern if (rfe_option == 2 || rfe_option == 0x22) or
if (rfe_option == 4 || rfe_option == 0x24), so that rfe_option BIT(5)
has no influence on the code path taken. We therefore mask BIT(5)
out from rfe_option entirely until this assumption is proved wrong
by some chip variant we do not know yet.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Tested-by: Alexandru gagniuc <mr.nuke.me@gmail.com>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Tested-by: ValdikSS <iam@valdikss.org.ru>
Cc: stable@vger.kernel.org
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230417140358.2240429-3-s.hauer@pengutronix.de
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-17 11:53:54 +02:00
..
admtek
ath wifi: ath11k: synchronize ath11k_mac_he_gi_to_nl80211_he_gi()'s return type 2023-05-11 23:03:42 +09:00
atmel
broadcom wifi: brcmfmac: support CQM RSSI notification with older firmware 2023-05-11 23:03:17 +09:00
cisco wifi: airo: do not assign -1 to unsigned char 2022-11-01 11:15:15 +02:00
intel wifi: iwlwifi: fw: fix memory leak in debugfs 2023-05-11 23:03:25 +09:00
intersil wifi: orinoco: check return value of hermes_write_wordrec() 2023-03-10 09:32:54 +01:00
marvell wifi: mwifiex: mark OF related data as maybe unused 2023-04-20 12:35:10 +02:00
mediatek wifi: mt76: connac: fix txd multicast rate setting 2023-05-11 23:03:24 +09:00
microchip wifi: wilc1000: add missing unregister_netdev() in wilc_netdev_ifc_init() 2023-03-10 09:32:50 +01:00
purelifi wifi: plfxlc: fix potential memory leak in __lf_x_usb_enable_rx() 2022-12-31 13:32:18 +01:00
quantenna treewide: use get_random_u32() when possible 2022-10-11 17:42:58 -06:00
ralink wifi: rt2x00: Fix memory leak when handling surveys 2023-05-11 23:03:20 +09:00
realtek wifi: rtw88: rtw8821c: Fix rfe_option field width 2023-05-17 11:53:54 +02:00
rsi wifi: rsi: Fix memory leak in rsi_coex_attach() 2023-03-10 09:32:48 +01:00
silabs
st treewide: use get_random_{u8,u16}() when possible, part 1 2022-10-11 17:42:58 -06:00
ti treewide: use get_random_u32() when possible 2022-10-11 17:42:58 -06:00
zydas
Kconfig
mac80211_hwsim.c wifi: mac80211_hwsim: fix debugfs attribute ps with rc table support 2022-10-21 12:37:28 +02:00
mac80211_hwsim.h
Makefile
ray_cs.c
ray_cs.h
rayctl.h
rndis_wlan.c wifi: rndis_wlan: Prevent buffer overflow in rndis_query_oid 2023-02-01 08:34:18 +01:00
virt_wifi.c
wl3501_cs.c wifi: wl3501_cs: don't call kfree_skb() under spin_lock_irqsave() 2023-03-10 09:32:51 +01:00
wl3501.h