linux-stable/drivers/thermal
Rafael J. Wysocki c1279dee33 thermal/debugfs: Prevent use-after-free from occurring after cdev removal
[ Upstream commit d351eb0ab0 ]

Since thermal_debug_cdev_remove() does not run under cdev->lock, it can
run in parallel with thermal_debug_cdev_state_update() and it may free
the struct thermal_debugfs object used by the latter after it has been
checked against NULL.

If that happens, thermal_debug_cdev_state_update() will access memory
that has been freed already causing the kernel to crash.

Address this by using cdev->lock in thermal_debug_cdev_remove() around
the cdev->debugfs value check (in case the same cdev is removed at the
same time in two different threads) and its reset to NULL.

Fixes: 755113d767 ("thermal/debugfs: Add thermal cooling device debugfs information")
Cc :6.8+ <stable@vger.kernel.org> # 6.8+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-05-17 12:14:29 +02:00
..
broadcom
intel powercap: intel_rapl: Fix locking in TPMI RAPL 2024-04-03 15:32:04 +02:00
mediatek thermal/drivers/mediatek: Fix control buffer enablement on MT7896 2024-04-03 15:32:18 +02:00
qcom Thermal control updates for 6.7-rc1 2023-10-31 15:28:37 -10:00
samsung thermal/drivers/exynos: Use set_trips ops 2024-01-02 09:33:19 +01:00
st
tegra
ti-soc-thermal
amlogic_thermal.c thermal: amlogic: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions 2024-01-02 09:33:18 +01:00
armada_thermal.c
cpufreq_cooling.c
cpuidle_cooling.c thermal: cpuidle_cooling: fix kernel-doc warning and a spello 2023-12-21 12:05:48 +01:00
da9062-thermal.c
db8500_thermal.c
devfreq_cooling.c thermal: devfreq_cooling: Fix perf state when calculate dfc res_util 2024-04-03 15:32:40 +02:00
dove_thermal.c
gov_bang_bang.c thermal: core: Pass trip pointer to governor throttle callback 2023-10-20 19:26:37 +02:00
gov_fair_share.c thermal: core: Pass trip pointer to governor throttle callback 2023-10-20 19:26:37 +02:00
gov_power_allocator.c thermal: gov_power_allocator: Allow binding without trip points 2024-04-10 16:38:13 +02:00
gov_step_wise.c thermal: core: Pass trip pointer to governor throttle callback 2023-10-20 19:26:37 +02:00
gov_user_space.c thermal: core: Pass trip pointer to governor throttle callback 2023-10-20 19:26:37 +02:00
hisi_thermal.c
imx8mm_thermal.c thermal/drivers/imx8mm_thermal: Fix function pointer declaration by adding identifier name 2023-10-15 23:40:09 +02:00
imx_sc_thermal.c
imx_thermal.c
k3_bandgap.c
k3_j72xx_bandgap.c
Kconfig More thermal control updates for 6.8-rc1 2024-01-17 14:47:33 -08:00
khadas_mcu_fan.c
kirkwood_thermal.c
loongson2_thermal.c thermal: loongson2: Replace of_device.h with explicit includes 2024-01-19 08:08:53 -06:00
Makefile More thermal control updates for 6.8-rc1 2024-01-17 14:47:33 -08:00
max77620_thermal.c thermal/drivers/max77620: Remove duplicate error message 2023-10-15 23:40:10 +02:00
qoriq_thermal.c thermal/drivers/qoriq: Fix getting tmu range 2024-03-26 18:17:31 -04:00
rcar_gen3_thermal.c
rcar_thermal.c
rockchip_thermal.c
rzg2l_thermal.c
spear_thermal.c
sprd_thermal.c
sun8i_thermal.c thermal/drivers/sun8i: Add D1/T113s THS controller support 2024-01-02 09:33:18 +01:00
thermal-generic-adc.c
thermal_core.c thermal: core: Use kstrdup_const() during cooling device registration 2024-01-12 15:38:23 +01:00
thermal_core.h thermal/debugfs: Add thermal cooling device debugfs information 2024-01-12 15:34:56 +01:00
thermal_debugfs.c thermal/debugfs: Prevent use-after-free from occurring after cdev removal 2024-05-17 12:14:29 +02:00
thermal_debugfs.h thermal/debugfs: Add thermal debugfs information for mitigation episodes 2024-01-12 15:37:49 +01:00
thermal_helpers.c thermal: helpers: Rearrange thermal_cdev_set_cur_state() 2024-01-12 15:38:23 +01:00
thermal_hwmon.c thermal: Drop redundant and confusing device_is_registered() checks 2023-12-12 13:00:28 +01:00
thermal_hwmon.h
thermal_mmio.c
thermal_netlink.c thermal: netlink: Rework notify API for cooling devices 2024-01-12 15:38:23 +01:00
thermal_netlink.h thermal: netlink: Rework notify API for cooling devices 2024-01-12 15:38:23 +01:00
thermal_of.c thermal/of: Assume polling-delay(-passive) 0 when absent 2024-04-13 13:10:10 +02:00
thermal_sysfs.c thermal/sysfs: Update governors when the 'weight' has changed 2023-12-29 18:01:01 +01:00
thermal_trace.h
thermal_trace_ipa.h thermal: gov_power_allocator: Change trace functions 2023-12-29 18:01:00 +01:00
thermal_trip.c Revert "thermal: core: Don't update trip points inside the hysteresis range" 2024-04-03 15:32:41 +02:00
uniphier_thermal.c