[PATCH ath-next 1/1] wifi: ath12k: avoid deadlock in thermal read
Nicolas Escande
nico.escande at gmail.com
Mon Apr 13 01:38:07 PDT 2026
When removing the pci device we can have a deadlock if we try to read the
thermal sensor at the same time.
This is due to the fact that when the wiphy gets unregistered (so while
the wiphy lock is held), we wait for all sysfs operation to complete. But
if a read of the thermal device has been started in the mean time, we need
to acquire the wiphy lock, which will lead to a deadlock.
As we already have a flag indicating that we are currently unregistering
the device in the hw group, lets check it first (before locking) so we can
bail out early and avoid the dealock.
Signed-off-by: Nicolas Escande <nico.escande at gmail.com>
---
drivers/net/wireless/ath/ath12k/thermal.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/wireless/ath/ath12k/thermal.c b/drivers/net/wireless/ath/ath12k/thermal.c
index a764d2112a3c..700e7458ddff 100644
--- a/drivers/net/wireless/ath/ath12k/thermal.c
+++ b/drivers/net/wireless/ath/ath12k/thermal.c
@@ -17,9 +17,13 @@ static ssize_t ath12k_thermal_temp_show(struct device *dev,
char *buf)
{
struct ath12k *ar = dev_get_drvdata(dev);
+ struct ath12k_hw_group *ag = ath12k_ab_to_ag(ar->ab);
unsigned long time_left;
int ret, temperature;
+ if (!test_bit(ATH12K_GROUP_FLAG_REGISTERED, &ag->flags))
+ return -ESHUTDOWN;
+
guard(wiphy)(ath12k_ar_to_hw(ar)->wiphy);
if (ar->ah->state != ATH12K_HW_STATE_ON)
--
2.53.0
More information about the ath12k
mailing list