[PATCH] wifi: ath9k: refuse spectral scan control while the hardware is disabled

From: Nerijus Bendžiūnas

Date: Tue Sep 08 2026 - 17:25:19 EST


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@xxxxxxxxx>
---
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