[PATCH rtw-next v3 0/2] wifi: rtw88: 8822c: fix cck_pd_set when the chip stops responding
From: Zeshan Ahmed Nobin
Date: Sun Nov 15 2026 - 15:20:30 EST
rtw8822c_phy_cck_pd_set() indexes its tables with two values read from
the chip, bw and nrx. When the chip stops responding, both can be
invalid; on PCIe, register reads then return all ones, so both are 3.
Patch 1 takes bw from rtwdev->hal.current_band_width instead, as Luka
Gejak suggested, which fixes the out-of-bounds access. Patch 2 makes the
function ignore nrx values without CCK PD registers, which Luka found
while reviewing v1.
The two belong together. With patch 1 alone, bw is always valid, so on
PCIe a chip that stops responding gets past the WARN_ON() in
rtw8822c_phy_cck_pd_set_reg() and reaches the zero-mask register access
that patch 2 prevents. Patch 2 indexes rtw8822c_cck_pd_reg[] with bw, so
it needs patch 1 first. Both are marked for stable.
v3:
- Patch 1: take bw from hal instead of reading it from the chip, and
drop the check (Luka)
- Patch 1: replace the forced-bw test, which no longer applies, with
real chip failures (Luka); add a check of hal against the register
- Patch 2: update the message and notes for the change in patch 1
(Luka)
- Patch 2: add Cc: stable, since with patch 1 a chip that stops
responding on PCIe reaches the zero-mask access
- Patch 2: add Luka's Reviewed-by; the code is unchanged
- Keep the order, and say here that the two belong together (Luka)
v2: https://lore.kernel.org/all/20261108182837.682661-1-zeshanahmednobin@xxxxxxxxx/
v1: https://lore.kernel.org/linux-wireless/20261105113415.73184-1-zeshanahmednobin@xxxxxxxxx/
AI assistance: I asked an AI coding assistant to help find out why the
RTL8822CE in my laptop keeps failing. It analyzed the kernel logs and
found the bw bug (Luka found the nrx one and suggested the approach in
patch 1), wrote the code, the debug-only changes used for testing, and
the messages. I reviewed everything and ran the tests described in each
patch before sending.
Zeshan Ahmed Nobin (2):
wifi: rtw88: 8822c: fix out-of-bounds access in cck_pd_set
wifi: rtw88: 8822c: ignore nrx values without CCK PD registers
drivers/net/wireless/realtek/rtw88/rtw8822c.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
base-commit: 04c9984187228904f222681661c50db3f0c50b71
--
2.43.0