Skip to content

Commit

Permalink
thermal: intel: int340x: processor_thermal: Fix deadlock
Browse files Browse the repository at this point in the history
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 <srinivas.pandruvada@intel.com>
Cc: 6.2+ <stable@vger.kernel.org> # 6.2+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Srinivas Pandruvada authored and Rafael J. Wysocki committed Mar 3, 2023
1 parent 0a3f9a6 commit 52f04f1
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int temp
proc_thermal_mmio_write(pci_info, PROC_THERMAL_MMIO_THRES_0, _temp);
proc_thermal_mmio_write(pci_info, PROC_THERMAL_MMIO_INT_ENABLE_0, 1);

thermal_zone_device_enable(tzd);
pci_info->stored_thres = temp;

return 0;
Expand Down Expand Up @@ -268,6 +267,10 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_
goto err_free_vectors;
}

ret = thermal_zone_device_enable(pci_info->tzone);
if (ret)
goto err_free_vectors;

return 0;

err_free_vectors:
Expand Down

0 comments on commit 52f04f1

Please sign in to comment.