[PATCH v3 1/5] wifi: ath9k_htc: report a failed multi-read as all ones

From: Nerijus Bendžiūnas

Date: Fri Sep 04 2026 - 14:53:28 EST


When the WMI command fails or times out, ath9k_multi_regread() logs
the failure and still copies its result buffer to the caller, so the
caller receives uninitialised stack data for every register it asked
for. ath9k_hw_update_mibstats(), ath9k_hw_usb_gen_fill_eeprom() and
ath9k_hw_read_array() all read through this path. ath9k_regread()
reports the same failure as -1.

Fill the caller's buffer with all ones instead, so a failed multi-read
looks like a failed single read. ath9k_hw_first_txpending(), added
later in this series, relies on this: a timed-out tx queue status read
must count as frames pending.

Fixes: 09a525d33870 ("ath9k_htc: Add multiple register read API")
Cc: stable@xxxxxxxxxxxxxxx
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Nerijus Bendžiūnas <nerijus.bendziunas@xxxxxxxxx>
---
drivers/net/wireless/ath/ath9k/htc_drv_init.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index 6de78ae85726..f5844e9bdd2d 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -273,6 +273,9 @@ static void ath9k_multi_regread(void *hw_priv, u32 *addr,
if (unlikely(ret)) {
ath_dbg(common, WMI,
"Multiple REGISTER READ FAILED (count: %d)\n", count);
+ /* Callers expect what a failed single read returns. */
+ memset(val, 0xff, sizeof(*val) * count);
+ return;
}

for (i = 0; i < count; i++) {
--
2.55.0