Skip to content

Commit fef0577

Browse files
lukaszluba-armdlezcano
authored andcommitted
thermal/core/fair share: Lock the thermal zone while looping over instances
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: stable@vger.kernel.org # 4.4+ Signed-off-by: Lukasz Luba <lukasz.luba@arm.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20210422153624.6074-2-lukasz.luba@arm.com
1 parent 0952177 commit fef0577

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

drivers/thermal/gov_fair_share.c

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

85+
mutex_lock(&tz->lock);
86+
8587
list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
8688
if (instance->trip != trip)
8789
continue;
@@ -110,6 +112,8 @@ static int fair_share_throttle(struct thermal_zone_device *tz, int trip)
110112
mutex_unlock(&instance->cdev->lock);
111113
thermal_cdev_update(cdev);
112114
}
115+
116+
mutex_unlock(&tz->lock);
113117
return 0;
114118
}
115119

0 commit comments

Comments
 (0)