diff options
| author | EDAMAMEX <edame8080@gmail.com> | 2026-05-20 16:02:11 +0900 |
|---|---|---|
| committer | Mario Limonciello <superm1@kernel.org> | 2026-07-22 13:45:48 -0500 |
| commit | 39c0cf62fc7851a17782e7efe8dfb2948739c681 (patch) | |
| tree | fb3e8ef3b6b6abb1531885c8833f2e8881fb5620 /include/scsi | |
| parent | d0f4c1c8cbffcfd5db683bd3f54396bfec12e9f5 (diff) | |
| download | linux-next-39c0cf62fc7851a17782e7efe8dfb2948739c681.tar.gz linux-next-39c0cf62fc7851a17782e7efe8dfb2948739c681.zip | |
cpufreq/amd-pstate: handle missing policy in dynamic EPP callbacks
cpufreq_cpu_get() returns NULL when no cpufreq policy is associated with
the requested CPU, for example because the CPU is offline or the policy
has already been torn down. Both amd_pstate_power_supply_notifier() and
amd_pstate_profile_set() acquire a policy via cpufreq_cpu_get() and then
pass that pointer to amd_pstate_get_balanced_epp() and
amd_pstate_set_epp(), which dereference it unconditionally. A racing
CPU hotplug or driver teardown can therefore lead to a NULL pointer
dereference on either of these dynamic EPP paths.
The third cpufreq_cpu_get() caller in this file, amd_pstate_verify(),
already handles the NULL case. Bring the two new callers in line with
that pattern: return NOTIFY_OK from the power-supply notifier (matching
the other "nothing to do" exits) and -ENODEV from amd_pstate_profile_set()
(the usual cpufreq error for a missing CPU policy).
Found by code inspection; not tested on hardware.
Fixes: e30ca6dd5345 ("cpufreq/amd-pstate: Add dynamic energy performance preference")
Fixes: 798c47593cca ("cpufreq/amd-pstate: Add support for platform profile class")
Signed-off-by: EDAMAMEX <edame8080@gmail.com>
Link: https://lore.kernel.org/r/20260520070211.2753183-1-edame8080@gmail.com
Signed-off-by: Mario Limonciello <superm1@kernel.org>
Diffstat (limited to 'include/scsi')
0 files changed, 0 insertions, 0 deletions
