[PATCH ath-current] wifi: ath9k_htc: clear csa_vif when a switch is aborted

From: Mehmet Fide

Date: Mon Oct 26 2026 - 11:25:55 EST


From: Mehmet Fide <mehmet.fide@xxxxxxxxxxxxxxxxxx>

priv->csa_vif is cleared only when the countdown completes or the
interface is removed. When mac80211 aborts a switch and stops
beaconing, as ieee80211_stop_ap() and ieee80211_stop_mesh() do, it
stays set, and the next switch on the interface hits the WARN_ON() in
ath9k_htc_channel_switch_beacon().

Clear it when beaconing stops and the switch is no longer active.
Off channel, beaconing stops with the switch still active and the
countdown continues afterwards, so keep it then.

Fixes: f0e449627e4a ("ath9k_htc: add support of channel switch")
Reported-by: Luka Gejak <luka.gejak@xxxxxxxxx>
Closes: https://lore.kernel.org/linux-wireless/c8bc5affa75d7519b424ea98c07c1d6b65942347@xxxxxxxxx/
Signed-off-by: Mehmet Fide <mehmet.fide@xxxxxxxxxxxxxxxxxx>
---

Notes:
Tested on an AR9271 (firmware 1.4), 6.12.114, also with PROVE_LOCKING
and DEBUG_ATOMIC_SLEEP. A mesh point left during its countdown and
joined again hit the WARN on the next switch 3/3 before, 0/8 after. An
IBSS does the same with [1] applied: 13/13 before, 0/35 after. A scan
during an IBSS countdown still lets the switch complete (24/24).

[1] https://lore.kernel.org/linux-wireless/20261025193615.1123718-1-mehmet.fide@xxxxxxxxx/

drivers/net/wireless/ath/ath9k/htc_drv_main.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 0d6272ac0dac..8080fff765e9 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1569,6 +1569,9 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw,
priv->cur_beacon_conf.enable_beacon = 0;
ath9k_htc_beacon_config(priv, vif);
}
+
+ if (priv->csa_vif == vif && !bss_conf->csa_active)
+ priv->csa_vif = NULL;
}

if (changed & BSS_CHANGED_BEACON_INT) {

base-commit: 9d8ec0b5b5295bd23d979d1b2b905de25c36fff2
--
2.55.0