Skip to content

Commit aaa18ff

Browse files
nfrapradorafaeljw
authored andcommitted
thermal: gov_power_allocator: Return early in manage if trip_max is NULL
Commit da78193 ("thermal: gov_power_allocator: Allow binding without trip points") allowed the governor to bind even when trip_max is NULL. This allows a NULL pointer dereference to happen in the manage callback. Add an early return to prevent it, since the governor is expected to not do anything in this case. Fixes: da78193 ("thermal: gov_power_allocator: Allow binding without trip points") Signed-off-by: Nícolas F. R. A. Prado <[email protected]> Link: https://patch.msgid.link/20240702-power-allocator-null-trip-max-v1-1-47a60dc55414@collabora.com Cc: All applicable <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 22a40d1 commit aaa18ff

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/thermal/gov_power_allocator.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,9 @@ static void power_allocator_manage(struct thermal_zone_device *tz)
759759
return;
760760
}
761761

762+
if (!params->trip_max)
763+
return;
764+
762765
allocate_power(tz, params->trip_max->temperature);
763766
params->update_cdevs = true;
764767
}

0 commit comments

Comments
 (0)