mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] wifi: ath9k: refuse spectral scan control while the hardware is disabled
@ 2026-09-08 18:03 Nerijus Bendžiūnas
  2026-09-09 11:02 ` Toke Høiland-Jørgensen
  0 siblings, 1 reply; 2+ messages in thread
From: Nerijus Bendžiūnas @ 2026-09-08 18:03 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen, linux-wireless; +Cc: linux-kernel

The spectral_scan_ctl debugfs file drives PHY register writes, and
nothing checks whether the hardware is up. While the interface is down
the chip is asleep, and on the AR9271 those writes go over WMI to a
sleeping target and hang the firmware until the device is re-enumerated.

Refuse the write with -EBUSY while ATH_OP_INVALID is set. The reset
control already refuses on the same flag.

Assisted-by: LLM
Signed-off-by: Nerijus Bendžiūnas <nerijus.bendziunas@gmail.com>
---
 drivers/net/wireless/ath/ath9k/common-spectral.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.c b/drivers/net/wireless/ath/ath9k/common-spectral.c
index ca01a07f6630..0bbbef9e3b9c 100644
--- a/drivers/net/wireless/ath/ath9k/common-spectral.c
+++ b/drivers/net/wireless/ath/ath9k/common-spectral.c
@@ -805,6 +805,14 @@ static ssize_t write_file_spec_scan_ctl(struct file *file,
 
 	buf[len] = '\0';
 
+	/* Every command below drives PHY register writes. Refuse them while
+	 * the hardware is disabled (the interface is down): on the AR9271
+	 * that traffic hangs the firmware until the device is re-enumerated.
+	 * The reset control refuses on the same flag.
+	 */
+	if (test_bit(ATH_OP_INVALID, &common->op_flags))
+		return -EBUSY;
+
 	if (strncmp("trigger", buf, 7) == 0) {
 		ath9k_cmn_spectral_scan_trigger(common, spec_priv);
 	} else if (strncmp("background", buf, 10) == 0) {

base-commit: 1d8e73163ef933624341075f576e2f36ef9133f7
-- 
2.55.0


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

end of thread, other threads:[~2026-09-09 11:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-08 18:03 [PATCH] wifi: ath9k: refuse spectral scan control while the hardware is disabled Nerijus Bendžiūnas
2026-09-09 11:02 ` Toke Høiland-Jørgensen

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®