[PATCH ath-next v3 13/13] wifi: ath11k: keep the cooling device across a firmware recovery

From: Julius Bairaktaris

Date: Sat Nov 21 2026 - 18:08:39 EST


ath11k_core_reconfigure_on_crash() unregisters the thermal cooling
devices of all radios, but ath11k_thermal_register() returns early once
ATH11K_FLAG_REGISTERED is set, so the recovery never registers them
again. After the first recovery the cooling devices and the phy's
cooling_device link are gone, and ar->thermal.cdev still points to the
freed cooling device.

The next ath11k_thermal_unregister(), from the second recovery or from
driver removal, passes that pointer to
thermal_cooling_device_unregister(). With CONFIG_THERMAL_DEBUGFS,
thermal_debug_cdev_remove() takes cdev->lock in the freed object. Without
it, thermal_cooling_device_exit() only compares the pointer with the
registered cooling devices, so it unregisters a cooling device that was
registered since and allocated at the same address.

Since ath11k_thermal_register() is a no-op during recovery, the cooling
devices stay registered like the radios: do not unregister them in
ath11k_core_reconfigure_on_crash(), and unwind them in
ath11k_core_pdev_create() only when this call registered them. Their
callbacks do not reach the firmware while it restarts:
ath11k_thermal_set_throttling() and ath11k_thermal_show_temp() return
early unless the radio is in ATH11K_STATE_ON.

Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.12-01460-QCAHKSWPL_SILICONZ-1

Fixes: 50556081e09b ("wifi: ath11k: thermal: don't try to register multiple times")
Signed-off-by: Julius Bairaktaris <julius@xxxxxxxxxxxxxx>
---
v3: new.

drivers/net/wireless/ath/ath11k/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index 0795ba7e038c..4aaac5200ed2 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -2072,7 +2072,8 @@ static int ath11k_core_pdev_create(struct ath11k_base *ab)
err_spectral_unregister:
ath11k_spectral_deinit(ab);
err_thermal_unregister:
- ath11k_thermal_unregister(ab);
+ if (!test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags))
+ ath11k_thermal_unregister(ab);
err_mac_unregister:
if (!test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags))
ath11k_mac_unregister(ab);
@@ -2342,7 +2343,6 @@ static int ath11k_core_reconfigure_on_crash(struct ath11k_base *ab)
mutex_lock(&ab->core_lock);
ath11k_hif_irq_disable(ab);
ath11k_hif_ce_irq_disable(ab);
- ath11k_thermal_unregister(ab);
ath11k_dp_pdev_free(ab);
ath11k_cfr_deinit(ab);
ath11k_spectral_deinit(ab);
--
2.53.0