Skip to content

Commit 52f04f1

Browse files
spandruvadarafaeljw
authored andcommitted
thermal: intel: int340x: processor_thermal: Fix deadlock
When user space updates the trip point there is a deadlock, which results in caller gets blocked forever. Commit 05eeee2 ("thermal/core: Protect sysfs accesses to thermal operations with thermal zone mutex"), added a mutex for tz->lock in the function trip_point_temp_store(). Hence, trip set callback() can't call any thermal zone API as they are protected with the same mutex lock. The callback here calling thermal_zone_device_enable(), which will result in deadlock. Move the thermal_zone_device_enable() to proc_thermal_pci_probe() to avoid this deadlock. Fixes: 05eeee2 ("thermal/core: Protect sysfs accesses to thermal operations with thermal zone mutex") Signed-off-by: Srinivas Pandruvada <[email protected]> Cc: 6.2+ <[email protected]> # 6.2+ Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 0a3f9a6 commit 52f04f1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int temp
166166
proc_thermal_mmio_write(pci_info, PROC_THERMAL_MMIO_THRES_0, _temp);
167167
proc_thermal_mmio_write(pci_info, PROC_THERMAL_MMIO_INT_ENABLE_0, 1);
168168

169-
thermal_zone_device_enable(tzd);
170169
pci_info->stored_thres = temp;
171170

172171
return 0;
@@ -268,6 +267,10 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_
268267
goto err_free_vectors;
269268
}
270269

270+
ret = thermal_zone_device_enable(pci_info->tzone);
271+
if (ret)
272+
goto err_free_vectors;
273+
271274
return 0;
272275

273276
err_free_vectors:

0 commit comments

Comments
 (0)