linux-yocto/drivers/powercap
Sivan Zohar-Kotzer 2fd001a007 powercap: dtpm_cpu: Fix NULL pointer dereference in get_pd_power_uw()
[ Upstream commit 46dc574068 ]

The get_pd_power_uw() function can crash with a NULL pointer dereference
when em_cpu_get() returns NULL. This occurs when a CPU becomes impossible
during runtime, causing get_cpu_device() to return NULL, which propagates
through em_cpu_get() and leads to a crash when em_span_cpus() dereferences
the NULL pointer.

Add a NULL check after em_cpu_get() and return 0 if unavailable,
matching the existing fallback behavior in __dtpm_cpu_setup().

Fixes: eb82bace89 ("powercap/drivers/dtpm: Scale the power with the load")
Signed-off-by: Sivan Zohar-Kotzer <sivany32@gmail.com>
Link: https://patch.msgid.link/20250701221355.96916-1-sivany32@gmail.com
[ rjw: Drop an excess empty code line ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-08-15 16:38:31 +02:00
..
arm_scmi_powercap.c
dtpm_cpu.c powercap: dtpm_cpu: Fix NULL pointer dereference in get_pd_power_uw() 2025-08-15 16:38:31 +02:00
dtpm_devfreq.c powercap: dtpm_devfreq: Fix error check against dev_pm_qos_add_request() 2024-10-21 13:23:06 +02:00
dtpm_subsys.h
dtpm.c powercap: dtpm: Fix kernel-doc for dtpm_create_hierarchy() function 2024-03-01 21:39:10 +01:00
idle_inject.c powercap: Switch to use hrtimer_setup() 2025-02-18 11:19:03 +01:00
intel_rapl_common.c powercap: intel_rapl: Do not change CLAMPING bit if ENABLE bit cannot be changed 2025-06-30 20:32:29 +02:00
intel_rapl_msr.c x86/msr: Add explicit includes of <asm/msr.h> 2025-05-02 10:23:47 +02:00
intel_rapl_tpmi.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
Kconfig PM: EM: Rework the depends on for CONFIG_ENERGY_MODEL 2025-03-07 15:23:46 +01:00
Makefile
powercap_sys.c powercap: call put_device() on an error path in powercap_register_control_type() 2025-01-23 21:28:18 +01:00