Skip to content

Commit 6e088a8

Browse files
lukaszluba-armgregkh
authored andcommitted
thermal/core/fair share: Lock the thermal zone while looping over instances
commit fef0577 upstream. The tz->lock must be hold during the looping over the instances in that thermal zone. This lock was missing in the governor code since the beginning, so it's hard to point into a particular commit. CC: [email protected] # 4.4+ Signed-off-by: Lukasz Luba <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a5e67c0 commit 6e088a8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/thermal/fair_share.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ static int fair_share_throttle(struct thermal_zone_device *tz, int trip)
9494
int total_instance = 0;
9595
int cur_trip_level = get_trip_level(tz);
9696

97+
mutex_lock(&tz->lock);
98+
9799
list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
98100
if (instance->trip != trip)
99101
continue;
@@ -122,6 +124,8 @@ static int fair_share_throttle(struct thermal_zone_device *tz, int trip)
122124
mutex_unlock(&instance->cdev->lock);
123125
thermal_cdev_update(cdev);
124126
}
127+
128+
mutex_unlock(&tz->lock);
125129
return 0;
126130
}
127131

0 commit comments

Comments
 (0)