diff options
| author | Sumeet Pawnikar <sumeet4linux@gmail.com> | 2026-08-22 17:12:36 +0530 |
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2026-09-11 15:41:14 +0200 |
| commit | d3515092f1bff9cfb4d99ea82dcd4ac66f32f50d (patch) | |
| tree | 89609da22e2ec94d899fca371734fd6853c115b1 /tools/perf/scripts/python/flamegraph.py | |
| parent | d98d8b50a87368880a58d04b48e5f66ba9d7cdc9 (diff) | |
thermal: gov_power_allocator: Fix NULL pointer dereference in update_tz()
power_allocator_update_tz() unconditionally derives the trip descriptor of
params->trip_max as below,
const struct thermal_trip_desc *td = trip_to_trip_desc(params->trip_max);
and then walks td->thermal_instances. However, params->trip_max is allowed
to be NULL and in that case the list walk dereferences a bogus pointer
derived from NULL which oops the kernel.
get_governor_trips() picks trip_switch_on and trip_max out of the trip
table of the zone. When the zone has neither a passive nor an active trip
point, last_active is NULL and params->trip_max is left NULL. This is an
explicitly supported configuration, as documented in the function
get_governor_trips() as below,
If there are no passive or active trip points, then the governor won't
do anything. In fact, its throttle function won't be called at all.
Return early from power_allocator_update_tz() when params->trip_max is NULL
and only compute the trip descriptor after that check. There is nothing to
update in that case anyway, with no trip_max and there are no thermal
instances for the governor to account for, num_actors stays zero and
total_weight is irrelevant.
Fixes: 912e97c67cc3 ("thermal: gov_power_allocator: Move memory allocation out of throttle()")
Signed-off-by: Sumeet Pawnikar <sumeet4linux@gmail.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Link: https://patch.msgid.link/20260822114236.15998-1-sumeet4linux@gmail.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'tools/perf/scripts/python/flamegraph.py')
0 files changed, 0 insertions, 0 deletions
