mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Nerijus Bendžiūnas" <nerijus.bendziunas@gmail.com>
To: "Toke Høiland-Jørgensen" <toke@toke.dk>, linux-wireless@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH v3 1/5] wifi: ath9k_htc: report a failed multi-read as all ones
Date: Fri,  4 Sep 2026 21:52:49 +0300	[thread overview]
Message-ID: <20260904185253.809209-2-nerijus.bendziunas@gmail.com> (raw)
In-Reply-To: <20260904185253.809209-1-nerijus.bendziunas@gmail.com>

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@vger.kernel.org
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Nerijus Bendžiūnas <nerijus.bendziunas@gmail.com>
---
 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


  reply	other threads:[~2026-09-04 18:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04 18:52 [PATCH v3 0/5] wifi: ath9k: cut USB round trips on channel changes Nerijus Bendžiūnas
2026-09-04 18:52 ` Nerijus Bendžiūnas [this message]
2026-09-04 18:52 ` [PATCH v3 2/5] wifi: ath9k: name the register multi-read limit Nerijus Bendžiūnas
2026-09-04 18:52 ` [PATCH v3 3/5] wifi: ath9k: check all tx queues with one multi-read Nerijus Bendžiūnas
2026-09-04 18:52 ` [PATCH v3 4/5] wifi: ath9k: batch the read-modify-writes of a channel change Nerijus Bendžiūnas
2026-09-04 18:52 ` [PATCH v3 5/5] wifi: ath9k: skip the old channel's noise floor on USB fast changes Nerijus Bendžiūnas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260904185253.809209-2-nerijus.bendziunas@gmail.com \
    --to=nerijus.bendziunas@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=toke@toke.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®