linux/drivers/thermal
brian-sy yang 34ab17cc6c thermal/drivers/cpufreq_cooling: Fix slab OOB issue
Slab OOB issue is scanned by KASAN in cpu_power_to_freq().
If power is limited below the power of OPP0 in EM table,
it will cause slab out-of-bound issue with negative array
index.

Return the lowest frequency if limited power cannot found
a suitable OPP in EM table to fix this issue.

Backtrace:
[<ffffffd02d2a37f0>] die+0x104/0x5ac
[<ffffffd02d2a5630>] bug_handler+0x64/0xd0
[<ffffffd02d288ce4>] brk_handler+0x160/0x258
[<ffffffd02d281e5c>] do_debug_exception+0x248/0x3f0
[<ffffffd02d284488>] el1_dbg+0x14/0xbc
[<ffffffd02d75d1d4>] __kasan_report+0x1dc/0x1e0
[<ffffffd02d75c2e0>] kasan_report+0x10/0x20
[<ffffffd02d75def8>] __asan_report_load8_noabort+0x18/0x28
[<ffffffd02e6fce5c>] cpufreq_power2state+0x180/0x43c
[<ffffffd02e6ead80>] power_actor_set_power+0x114/0x1d4
[<ffffffd02e6fac24>] allocate_power+0xaec/0xde0
[<ffffffd02e6f9f80>] power_allocator_throttle+0x3ec/0x5a4
[<ffffffd02e6ea888>] handle_thermal_trip+0x160/0x294
[<ffffffd02e6edd08>] thermal_zone_device_check+0xe4/0x154
[<ffffffd02d351cb4>] process_one_work+0x5e4/0xe28
[<ffffffd02d352f44>] worker_thread+0xa4c/0xfac
[<ffffffd02d360124>] kthread+0x33c/0x358
[<ffffffd02d289940>] ret_from_fork+0xc/0x18

Fixes: 371a3bc79c ("thermal/drivers/cpufreq_cooling: Fix wrong frequency converted from power")
Signed-off-by: brian-sy yang <brian-sy.yang@mediatek.com>
Signed-off-by: Michael Kao <michael.kao@mediatek.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Cc: stable@vger.kernel.org #v5.7
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20201229050831.19493-1-michael.kao@mediatek.com
2021-04-15 13:21:42 +02:00
..
broadcom thermal: broadcom: simplify the return expression of bcm2711_thermal_probe() 2020-12-10 18:29:43 +01:00
intel - Use the newly introduced 'hot' and 'critical' ops for the acpi 2021-02-22 09:39:11 -08:00
qcom thermal/drivers/qcom/tsens_v1: Enable sensor 3 on MSM8976 2021-03-17 20:08:30 +01:00
samsung thermal: exynos: Silence warning during deferred probe 2020-03-12 11:56:53 +01:00
st thermal: stm32: simplify the return expression of stm_thermal_prepare() 2020-10-12 12:08:35 +02:00
tegra thermal: Fix a typo in the file soctherm.c 2021-03-10 12:54:58 +01:00
ti-soc-thermal thermal:ti-soc-thermal: Remove duplicate include in ti-bandgap 2021-03-10 13:04:16 +01:00
amlogic_thermal.c thermal: amlogic: Omit superfluous error message in amlogic_thermal_probe() 2021-03-10 12:52:55 +01:00
armada_thermal.c thermal: Explicitly enable non-changing thermal zone devices 2020-06-29 20:26:37 +02:00
cpufreq_cooling.c thermal/drivers/cpufreq_cooling: Fix slab OOB issue 2021-04-15 13:21:42 +02:00
cpuidle_cooling.c thermal/drivers/cpuidle_cooling: Fix use after error 2021-04-15 13:21:26 +02:00
da9062-thermal.c thermal/core: Remove ms based delay fields 2021-01-19 22:23:49 +01:00
db8500_thermal.c thermal: db8500: Depromote debug print 2020-01-27 10:24:32 +01:00
devfreq_cooling.c thermal/drivers/devfreq_cooling: Fix wrong return on error path 2021-04-15 13:21:16 +02:00
dove_thermal.c thermal: Explicitly enable non-changing thermal zone devices 2020-06-29 20:26:37 +02:00
gov_bang_bang.c thermal: step_wise: Appease the kernel-doc deity 2020-01-27 10:24:32 +01:00
gov_fair_share.c thermal/governors: Prefix all source files with gov_ 2020-05-22 18:48:54 +02:00
gov_power_allocator.c thermal/core/power_allocator: Using round the division when re-divvying up power 2021-03-16 12:44:20 +01:00
gov_step_wise.c thermal/core: Remove the 'forced_passive' option 2021-01-19 22:22:45 +01:00
gov_user_space.c thermal/governors: Prefix all source files with gov_ 2020-05-22 18:48:54 +02:00
hisi_thermal.c thermal/drivers/hisi: Use the correct HiSilicon copyright 2021-04-15 13:21:42 +02:00
imx8mm_thermal.c thermal: imx8mm: Disable the clock on probe failure 2020-12-04 20:46:03 +01:00
imx_sc_thermal.c - Add the hwmon support on the i.MX SC (Anson Huang) 2020-06-12 14:10:21 -07:00
imx_thermal.c thermal: imx: Use dev_err_probe() to simplify error handling 2020-10-12 12:08:34 +02:00
k3_bandgap.c thermal: k3: Add support for bandgap sensors 2020-04-14 11:41:12 +02:00
Kconfig thermal/drivers/zx: Remove zx driver 2021-02-03 09:17:47 +01:00
khadas_mcu_fan.c thermal/core: Make cooling device state change private 2021-01-19 22:31:10 +01:00
kirkwood_thermal.c thermal: Explicitly enable non-changing thermal zone devices 2020-06-29 20:26:37 +02:00
Makefile thermal/drivers/zx: Remove zx driver 2021-02-03 09:17:47 +01:00
max77620_thermal.c thermal: max77620: Appease the kernel-doc deity 2020-01-27 10:24:32 +01:00
mtk_thermal.c thermal: mtk_thermal: make device_reset optional 2020-10-27 11:19:18 +01:00
qoriq_thermal.c thermal: qoriq: Update the settings for TMUv2 2020-05-29 20:26:51 +02:00
rcar_gen3_thermal.c thermal: rcar_gen3_thermal: Add support for up to five TSC nodes 2021-03-10 12:58:28 +01:00
rcar_thermal.c thermal/drivers/rcar: Remove notification usage 2020-12-15 17:01:55 +01:00
rockchip_thermal.c thermal: Use mode helpers in drivers 2020-06-29 20:26:36 +02:00
spear_thermal.c thermal: Explicitly enable non-changing thermal zone devices 2020-06-29 20:26:37 +02:00
sprd_thermal.c - Add support to enable/disable the thermal zones resulting on core code and 2020-08-06 18:10:55 -07:00
sun8i_thermal.c thermal: Fix couple of spellos in the file sun8i_thermal.c 2021-03-10 12:54:58 +01:00
thermal-generic-adc.c thermal: generic-adc: silence info message for IIO_TEMP channels 2020-01-27 10:24:32 +01:00
thermal_core.c thermal/core: Fix memory leak in the error path 2021-04-15 13:21:00 +02:00
thermal_core.h thermal/core: Make cooling device state change private 2021-01-19 22:31:10 +01:00
thermal_helpers.c thermal/core: Precompute the delays from msecs to jiffies 2021-01-19 22:23:38 +01:00
thermal_hwmon.c thermal/drivers/hwmon: Cleanup coding style a bit 2020-11-12 11:24:01 +01:00
thermal_hwmon.h thermal_hwmon: Add devres wrapper for thermal_add_hwmon_sysfs() 2020-01-27 10:24:32 +01:00
thermal_mmio.c thermal: no need to set .owner when using module_platform_driver 2019-11-07 07:00:26 +01:00
thermal_netlink.c - Fix Kconfig typo "acces" -> "access" (Colin Ian King) 2020-10-17 10:40:22 -07:00
thermal_netlink.h thermal: netlink: Improve the initcall ordering 2020-07-21 10:40:08 +02:00
thermal_of.c thermal: thermal_of: Fix error return code of thermal_of_populate_bind_params() 2021-03-10 13:41:33 +01:00
thermal_sysfs.c thermal/core: Remove pointless test with the THERMAL_TRIPS_NONE macro 2021-01-19 22:23:11 +01:00
uniphier_thermal.c thermal: uniphier: Convert to SPDX identifier 2019-01-02 04:47:16 -08:00