linux-stable/drivers/powercap
Cristian Marussi b427c23ceb powercap: arm_scmi: Remove recursion while parsing zones
[ Upstream commit 3e767d6850 ]

Powercap zones can be defined as arranged in a hierarchy of trees and when
registering a zone with powercap_register_zone(), the kernel powercap
subsystem expects this to happen starting from the root zones down to the
leaves; on the other side, de-registration by powercap_deregister_zone()
must begin from the leaf zones.

Available SCMI powercap zones are retrieved dynamically from the platform
at probe time and, while any defined hierarchy between the zones is
described properly in the zones descriptor, the platform returns the
availables zones with no particular well-defined order: as a consequence,
the trees possibly composing the hierarchy of zones have to be somehow
walked properly to register the retrieved zones from the root.

Currently the ARM SCMI Powercap driver walks the zones using a recursive
algorithm; this approach, even though correct and tested can lead to kernel
stack overflow when processing a returned hierarchy of zones composed by
particularly high trees.

Avoid possible kernel stack overflow by substituting the recursive approach
with an iterative one supported by a dynamically allocated stack-like data
structure.

Fixes: b55eef5226 ("powercap: arm_scmi: Add SCMI Powercap based driver")
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-09-13 09:47:57 +02:00
..
arm_scmi_powercap.c powercap: arm_scmi: Remove recursion while parsing zones 2023-09-13 09:47:57 +02:00
dtpm.c powercap: DTPM: Fix spelling mistake "initialze" -> "initialize" 2022-03-01 18:59:35 +01:00
dtpm_cpu.c Power management updates for 5.20-rc1 2022-08-02 11:17:00 -07:00
dtpm_devfreq.c powercap/drivers/dtpm: Add dtpm devfreq with energy model support 2022-02-04 17:38:09 +01:00
dtpm_subsys.h powercap/drivers/dtpm: Add dtpm devfreq with energy model support 2022-02-04 17:38:09 +01:00
idle_inject.c Thermal control updates for 6.3-rc1 2023-02-21 12:32:05 -08:00
intel_rapl_common.c powercap: intel_rapl: Fix handling for large time window 2023-02-13 17:01:31 +01:00
intel_rapl_msr.c powercap: RAPL: Fix CONFIG_IOSF_MBI dependency 2023-07-19 16:35:15 +02:00
Kconfig powercap: RAPL: Fix CONFIG_IOSF_MBI dependency 2023-07-19 16:35:15 +02:00
Makefile powercap: arm_scmi: Add SCMI Powercap based driver 2022-10-25 18:53:15 +02:00
powercap_sys.c powercap: remove MODULE_LICENSE in non-modules 2023-02-28 21:32:05 +01:00