Centos-kernel-stream-9/drivers/thermal
David Arcari ea412066c7 thermal/debugfs: Fix two locking issues with thermal zone debug
JIRA: https://issues.redhat.com/browse/RHEL-40008
CVE: CVE-2024-36961

commit c7f7c37271787a7f77d7eedc132b0b419a76b4c8
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Thu Apr 25 20:00:33 2024 +0200

    thermal/debugfs: Fix two locking issues with thermal zone debug

    With the current thermal zone locking arrangement in the debugfs code,
    user space can open the "mitigations" file for a thermal zone before
    the zone's debugfs pointer is set which will result in a NULL pointer
    dereference in tze_seq_start().

    Moreover, thermal_debug_tz_remove() is not called under the thermal
    zone lock, so it can run in parallel with the other functions accessing
    the thermal zone's struct thermal_debugfs object.  Then, it may clear
    tz->debugfs after one of those functions has checked it and the
    struct thermal_debugfs object may be freed prematurely.

    To address the first problem, pass a pointer to the thermal zone's
    struct thermal_debugfs object to debugfs_create_file() in
    thermal_debug_tz_add() and make tze_seq_start(), tze_seq_next(),
    tze_seq_stop(), and tze_seq_show() retrieve it from s->private
    instead of a pointer to the thermal zone object.  This will ensure
    that tz_debugfs will be valid across the "mitigations" file accesses
    until thermal_debugfs_remove_id() called by thermal_debug_tz_remove()
    removes that file.

    To address the second problem, use tz->lock in thermal_debug_tz_remove()
    around the tz->debugfs value check (in case the same thermal zone is
    removed at the same time in two different threads) and its reset to NULL.

    Fixes: 7ef01f228c9f ("thermal/debugfs: Add thermal debugfs information for mitigation episodes")
    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: David Arcari <darcari@redhat.com>
2024-06-05 08:12:45 -04:00
..
broadcom
intel Merge: Update drivers/thermal/intel 2024-05-08 19:42:55 +00:00
qcom thermal/drivers/tsens: Add suspend to RAM support for tsens 2024-05-14 16:47:46 -04:00
samsung
st
tegra
ti-soc-thermal
Kconfig thermal: Get rid of CONFIG_THERMAL_WRITABLE_TRIPS 2024-05-03 16:26:50 -04:00
Makefile thermal/debugfs: Add thermal cooling device debugfs information 2024-05-03 16:26:49 -04:00
amlogic_thermal.c
armada_thermal.c
cpufreq_cooling.c
cpuidle_cooling.c
da9062-thermal.c
db8500_thermal.c
devfreq_cooling.c
dove_thermal.c
gov_bang_bang.c thermal: core: Pass trip pointer to governor throttle callback 2024-05-03 16:26:47 -04:00
gov_fair_share.c thermal: core: Pass trip pointer to governor throttle callback 2024-05-03 16:26:47 -04:00
gov_power_allocator.c thermal: core: Pass trip pointer to governor throttle callback 2024-05-03 16:26:47 -04:00
gov_step_wise.c thermal: core: Pass trip pointer to governor throttle callback 2024-05-03 16:26:47 -04:00
gov_user_space.c thermal: core: Pass trip pointer to governor throttle callback 2024-05-03 16:26:47 -04:00
hisi_thermal.c
imx8mm_thermal.c
imx_sc_thermal.c
imx_thermal.c thermal: core: Store zone trips table in struct thermal_zone_device 2024-05-03 16:26:50 -04:00
k3_bandgap.c
k3_j72xx_bandgap.c
khadas_mcu_fan.c
kirkwood_thermal.c
max77620_thermal.c
mtk_thermal.c
qoriq_thermal.c
rcar_gen3_thermal.c Merge: Update drivers/thermal/intel 2024-05-08 19:42:55 +00:00
rcar_thermal.c Merge: Update drivers/thermal/intel 2024-05-08 19:42:55 +00:00
rockchip_thermal.c
rzg2l_thermal.c
spear_thermal.c
sprd_thermal.c
sun8i_thermal.c
thermal-generic-adc.c
thermal_core.c thermal: core: Remove excess empty line from a comment 2024-05-03 16:26:50 -04:00
thermal_core.h thermal: core: Add flags to struct thermal_trip 2024-05-03 16:26:50 -04:00
thermal_debugfs.c thermal/debugfs: Fix two locking issues with thermal zone debug 2024-06-05 08:12:45 -04:00
thermal_debugfs.h thermal/debugfs: Add thermal debugfs information for mitigation episodes 2024-05-03 16:26:49 -04:00
thermal_helpers.c thermal: core: Store zone ops in struct thermal_zone_device 2024-05-03 16:26:50 -04:00
thermal_hwmon.c thermal: core: Store zone ops in struct thermal_zone_device 2024-05-03 16:26:50 -04:00
thermal_hwmon.h
thermal_mmio.c
thermal_netlink.c thermal: netlink: Pass thermal zone pointer to notify routines 2024-05-03 16:26:49 -04:00
thermal_netlink.h thermal: netlink: Pass thermal zone pointer to notify routines 2024-05-03 16:26:49 -04:00
thermal_of.c thermal: core: Store zone ops in struct thermal_zone_device 2024-05-03 16:26:50 -04:00
thermal_sysfs.c thermal: core: remove unnecessary check in trip_point_hyst_store() 2024-05-03 16:26:50 -04:00
thermal_trace.h
thermal_trace_ipa.h
thermal_trip.c Revert "thermal: core: Don't update trip points inside the hysteresis range" 2024-05-03 16:26:50 -04:00
uniphier_thermal.c