linux/drivers/thermal
Viresh Kumar 80bb3b901a thermal: Validate new state in cur_state_store()
[ Upstream commit c408b3d1d9 ]

In cur_state_store(), the new state of the cooling device is received
from user-space and is not validated by the thermal core but the same is
left for the individual drivers to take care of. Apart from duplicating
the code it leaves possibility for introducing bugs where a driver may
not do it right.

Lets make the thermal core check the new state itself and store the max
value in the cooling device structure.

Link: https://lore.kernel.org/all/Y0ltRJRjO7AkawvE@kili/
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Stable-dep-of: 6c54b7bc8a ("thermal: core: call put_device() only after device_register() fails")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-02-01 08:34:26 +01:00
..
broadcom thermal/drivers/broadcom: Switch to new of API 2022-08-17 14:09:38 +02:00
intel thermal: int340x: Add missing attribute for data rate base 2023-01-12 12:02:50 +01:00
qcom thermal/drivers/qcom/lmh: Fix irq handler return value 2022-12-31 13:32:43 +01:00
samsung thermal/drivers/samsung: Switch to new of thermal API 2022-08-17 14:09:39 +02:00
st thermal/drivers/st: Switch to new of API 2022-08-17 14:09:38 +02:00
tegra thermal/drivers/tegra: Switch to new of API 2022-08-17 14:09:38 +02:00
ti-soc-thermal thermal/drivers/ti-soc: Switch to new of API 2022-08-17 14:09:38 +02:00
amlogic_thermal.c thermal/drivers/amlogic: Switch to new of API 2022-08-17 14:09:38 +02:00
armada_thermal.c thermal/drivers/armada: Switch to new of API 2022-08-17 14:09:38 +02:00
cpufreq_cooling.c Merge branches 'thermal-intel' and 'thermal-drivers' 2022-10-03 20:43:32 +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: da9062-thermal: Drop redundant error message 2022-08-31 20:58:25 +02:00
db8500_thermal.c thermal/drivers/db8500: Switch to new of API 2022-08-17 14:09:38 +02:00
devfreq_cooling.c Thermal control updates for 5.20-rc1 2022-08-02 11:27:53 -07:00
dove_thermal.c
gov_bang_bang.c thermal/core: Move the thermal zone lock out of the governors 2022-08-17 14:09:39 +02:00
gov_fair_share.c thermal: Validate new state in cur_state_store() 2023-02-01 08:34:26 +01:00
gov_power_allocator.c thermal/core: Move the thermal zone lock out of the governors 2022-08-17 14:09:39 +02:00
gov_step_wise.c thermal/core: Move the thermal zone lock out of the governors 2022-08-17 14:09:39 +02:00
gov_user_space.c thermal: gov_user_space: Do not lock thermal zone mutex 2022-08-30 20:18:47 +02:00
hisi_thermal.c thermal/drivers/hisilicon: Switch to new of API 2022-08-17 14:09:38 +02:00
imx8mm_thermal.c thermal/drivers/imx8mm_thermal: Validate temperature range 2022-12-31 13:32:43 +01:00
imx_sc_thermal.c thermal/drivers/imx_sc: Rely on the platform data to get the resource id 2022-10-04 11:20:59 +02:00
imx_thermal.c thermal/drivers/imx: Implement runtime PM support 2021-11-30 15:42:28 +01:00
k3_bandgap.c thermal/drivers/banggap: Switch to new of API 2022-08-17 14:09:38 +02:00
k3_j72xx_bandgap.c thermal/drivers/k3_j72xx_bandgap: Fix the debug print message 2022-12-31 13:32:43 +01:00
Kconfig thermal: Drop obsolete dependency on COMPILE_TEST 2022-08-03 19:15:31 +02:00
khadas_mcu_fan.c
kirkwood_thermal.c
Makefile thermal/drivers/qcom: Drop false build dependency of all QCOM drivers on QCOM_TSENS 2022-10-04 11:21:11 +02:00
max77620_thermal.c thermal/drivers/maxim: Switch to new of API 2022-08-17 14:09:38 +02:00
mtk_thermal.c thermal/drivers/mtk: Switch to new of API 2022-08-17 14:09:38 +02:00
qoriq_thermal.c thermal/drivers/qoriq: Switch to new of API 2022-08-17 14:09:38 +02:00
rcar_gen3_thermal.c thermal/drivers/rcar: Switch to new of API 2022-08-17 14:09:38 +02:00
rcar_thermal.c thermal/drivers/rcar_thermal: Constify static thermal_zone_device_ops 2022-10-04 11:21:18 +02:00
rockchip_thermal.c thermal/drivers/rockchip: Switch to new of API 2022-08-17 14:09:37 +02:00
rzg2l_thermal.c thermal/drivers/rzg2l: Switch to new of API 2022-08-17 14:09:38 +02:00
spear_thermal.c
sprd_thermal.c thermal/drivers/sprd: Switch to new of API 2022-08-17 14:09:38 +02:00
sun8i_thermal.c thermal/drivers/sun8i: Switch to new of API 2022-08-17 14:09:38 +02:00
thermal_core.c thermal: Validate new state in cur_state_store() 2023-02-01 08:34:26 +01:00
thermal_core.h thermal/core: Move the mutex inside the thermal_zone_device_update() function 2022-08-17 14:09:39 +02:00
thermal_helpers.c thermal/core: Ensure that thermal device is registered in thermal_zone_get_temp 2022-12-31 13:32:57 +01:00
thermal_hwmon.c thermal: move from strlcpy() with unused retval to strscpy() 2022-08-31 21:13:35 +02:00
thermal_hwmon.h
thermal_mmio.c Merge branches 'thermal-intel' and 'thermal-drivers' 2022-10-03 20:43:32 +02:00
thermal_netlink.c genetlink: start to validate reserved header bytes 2022-08-29 12:47:15 +01:00
thermal_netlink.h thermal: netlink: Fix parameter type of thermal_genl_cpu_capability_event() stub 2022-02-07 20:45:42 +01:00
thermal_of.c thermal/of: Fix memory leak on thermal_of_zone_register() failure 2022-12-31 13:32:43 +01:00
thermal_sysfs.c thermal: Validate new state in cur_state_store() 2023-02-01 08:34:26 +01:00
thermal-generic-adc.c thermal/drivers/generic-adc: Switch to new of API 2022-08-17 14:09:37 +02:00
uniphier_thermal.c thermal/drivers/uniphier: Switch to new of API 2022-08-17 14:09:37 +02:00