linux-stable/drivers/thermal
Rafael J. Wysocki 06d6eb948e thermal: sysfs: Fix cooling_device_stats_setup() error code path
commit d5a8aa5d7d upstream.

If cooling_device_stats_setup() fails to create the stats object, it
must clear the last slot in cooling_device_attr_groups that was
initially empty (so as to make it possible to add stats attributes to
the cooling device attribute groups).

Failing to do so may cause the stats attributes to be created by
mistake for a device that doesn't have a stats object, because the
slot in question might be populated previously during the registration
of another cooling device.

Fixes: 8ea229511e ("thermal: Add cooling device's statistics in sysfs")
Reported-by: Di Shen <di.shen@unisoc.com>
Tested-by: Di Shen <di.shen@unisoc.com>
Cc: 4.17+ <stable@vger.kernel.org> # 4.17+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-17 14:22:50 +02:00
..
broadcom thermal/drivers/broadcom: Fix potential NULL dereference in sr_thermal_probe 2022-06-09 10:23:01 +02:00
intel thermal: int340x: Fix attr.show callback prototype 2022-05-09 09:14:42 +02:00
qcom
samsung
st
tegra
ti-soc-thermal
amlogic_thermal.c
armada_thermal.c
cpufreq_cooling.c
cpuidle_cooling.c
da9062-thermal.c
db8500_thermal.c
devfreq_cooling.c thermal: devfreq_cooling: use local ops instead of global ops 2022-06-09 10:23:26 +02:00
dove_thermal.c
gov_bang_bang.c
gov_fair_share.c
gov_power_allocator.c
gov_step_wise.c
gov_user_space.c
hisi_thermal.c
imx8mm_thermal.c
imx_sc_thermal.c thermal/drivers/imx_sc_thermal: Fix refcount leak in imx_sc_thermal_probe 2022-06-09 10:23:01 +02:00
imx_thermal.c
k3_bandgap.c
Kconfig
khadas_mcu_fan.c
kirkwood_thermal.c
Makefile
max77620_thermal.c
mtk_thermal.c
qoriq_thermal.c
rcar_gen3_thermal.c
rcar_thermal.c
rockchip_thermal.c
spear_thermal.c
sprd_thermal.c
sun8i_thermal.c
thermal-generic-adc.c
thermal_core.c thermal/core: Fix memory leak in __thermal_cooling_device_register() 2022-06-09 10:23:01 +02:00
thermal_core.h
thermal_helpers.c
thermal_hwmon.c
thermal_hwmon.h
thermal_mmio.c
thermal_netlink.c thermal: core: Fix TZ_GET_TRIP NULL pointer dereference 2022-03-08 19:12:43 +01:00
thermal_netlink.h
thermal_of.c
thermal_sysfs.c thermal: sysfs: Fix cooling_device_stats_setup() error code path 2022-08-17 14:22:50 +02:00
uniphier_thermal.c