thermal: int340x: processor_thermal: Fix deadlock
Subsystems (2)
PATCH 1/1 thermal: int340x: processor_thermal: Fix deadlock
From: Srinivas Pandruvada <[email protected]>
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.
---
The commit which caused this issue was added during v6.2 cycle.
.../intel/int340x_thermal/processor_thermal_device_pci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c +4 -1
@@ -194,7 +194,6 @@ static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int tempproc_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 ;
@@ -277,6 +276,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:
Signature · 1 line
2.34.1
Greg KH
maintainerQuoted 13 lines · Srinivas Pandruvada
From: Srinivas Pandruvada <[email protected]>
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 fortz->lockin the functiontrip_point_temp_store(). Hence, trip setcallback()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.
Quoted 7 lines
Move the
thermal_zone_device_enable()toproc_thermal_pci_probe()to avoid this deadlock.Signed-off-by Srinivas Pandruvada <[email protected]>---
The commit which caused this issue was added during v6.2 cycle.
What commit exactly? Always list that as a Fixes: tag if you know this.
thanks,
greg k-h
Rafael J. Wysocki
maintainerQuoted 18 lines · Greg KH
Quoted 16 lines · Srinivas Pandruvada
From: Srinivas Pandruvada <[email protected]>
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 fortz->lockin the functiontrip_point_temp_store(). Hence, trip setcallback()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()toproc_thermal_pci_probe()to avoid this deadlock.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Srinivas Pandruvada <[email protected]>---
The commit which caused this issue was added during v6.2 cycle.What commit exactly? Always list that as a Fixes: tag if you know this.
It's there in the changelog above.
I'll add a Fixes: tag to this one when applying it.
Cheers!
Rafael J. Wysocki
maintainerQuoted 39 lines · Srinivas Pandruvada
From: Srinivas Pandruvada <[email protected]>
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 fortz->lockin the functiontrip_point_temp_store(). Hence, trip setcallback()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()toproc_thermal_pci_probe()to avoid this deadlock.Signed-off-by Srinivas Pandruvada <[email protected]>---
The commit which caused this issue was added during v6.2 cycle..../intel/int340x_thermal/processor_thermal_device_pci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c +0
-1@@ -194,7 +194,6 @@ static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int tempproc_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 ;@@ -277,6 +276,10 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_ goto err_free_vectors;
drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_
Quoted 10 lines
drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c +4
-1} + ret =thermal_zone_device_enable (pci_info->tzone); +if (ret) + goto err_free_vectors; +return 0 ; err_free_vectors: --
Now queued up for 6.3-rc with a Fixes: tag added, thanks!