Skip to contentSkip to conversation

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

PATCH Applied Nerijus Bendžiūnas 3 participants 3 messages Sep 8 – Oct 5 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: ath9k: refuse spectral scan control while the hardware is disabled

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
---
 drivers/net/wireless/ath/ath9k/common-spectral.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/wireless/ath/ath9k/common-spectral.c +8 -0
index ca01a07f6630..0bbbef9e3b9c 100644
@@ -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

Signature · 1 line
2.55.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Nerijus Bendžiūnas

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
Applied
#2 lore raw
In reply to Nerijus Bendžiūnas
Quoted 9 lines · Nerijus Bendžiūnas

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.

[...]

Applied, thanks!

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

      commit: 59411703660919197234fa0ec80ee1a5bcbe4276

Best regards,

Signature · 1 line
Jeff Johnson <[email protected]>