Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 05eeee2b51b4 ("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: 05eeee2b51b4 ("thermal/core: Protect sysfs accesses to thermal operations with thermal zone mutex")
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@intel.com>
Cc: 6.2+ <stable@vger.kernel.org> # 6.2+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Srinivas Pandruvada and committed by
Rafael J. Wysocki
52f04f10 0a3f9a6b

+4 -1
+4 -1
drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c
··· 166 166 proc_thermal_mmio_write(pci_info, PROC_THERMAL_MMIO_THRES_0, _temp); 167 167 proc_thermal_mmio_write(pci_info, PROC_THERMAL_MMIO_INT_ENABLE_0, 1); 168 168 169 - thermal_zone_device_enable(tzd); 170 169 pci_info->stored_thres = temp; 171 170 172 171 return 0; ··· 266 267 dev_err(&pdev->dev, "Request IRQ %d failed\n", pdev->irq); 267 268 goto err_free_vectors; 268 269 } 270 + 271 + ret = thermal_zone_device_enable(pci_info->tzone); 272 + if (ret) 273 + goto err_free_vectors; 269 274 270 275 return 0; 271 276