linux-stable/drivers/thermal
Aaron Hill a99e0377cc drivers: thermal: int340x_thermal: Fix sysfs race condition
[ Upstream commit 129699bb8c ]

Changes since V1:
* Use dev_info instead of printk
* Use dev_warn instead of BUG_ON

Previously, sysfs_create_group was called before all initialization had
fully run - specifically, before pci_set_drvdata was called. Since the
sysctl group is visible to userspace as soon as sysfs_create_group
returns, a small window of time existed during which a process could read
from an uninitialized/partially-initialized device.

This commit moves the creation of the sysctl group to after all
initialized is completed. This ensures that it's impossible for
userspace to read from a sysctl file before initialization has fully
completed.

To catch any future regressions, I've added a check to ensure
that proc_thermal_emum_mode is never PROC_THERMAL_NONE when a process
tries to read from a sysctl file. Previously, the aforementioned race
condition could result in the 'else' branch
running while PROC_THERMAL_NONE was set,
leading to a null pointer deference.

Signed-off-by: Aaron Hill <aa1ronham@gmail.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-03-05 17:58:48 +01:00
..
broadcom thermal: bcm2835: enable hwmon explicitly 2019-02-12 19:47:19 +01:00
int340x_thermal drivers: thermal: int340x_thermal: Fix sysfs race condition 2019-03-05 17:58:48 +01:00
qcom thermal: tsens: Fix negative temperature reporting 2018-07-27 15:16:55 -07:00
samsung thermal: samsung: Remove Exynos5440 clock handling left-overs 2018-07-27 16:21:40 -07:00
st
tegra - Error path bug fix for overflow tests (Dan) 2018-06-12 18:28:00 -07:00
ti-soc-thermal thermal: ti-soc-thermal: remove dead code 2018-07-27 14:43:01 -07:00
armada_thermal.c thermal: armada: fix legacy validity test sense 2018-12-21 14:15:22 +01:00
clock_cooling.c
cpu_cooling.c
da9062-thermal.c thermal: da9062/61: Prevent hardware access during system suspend 2018-11-13 11:08:31 -08:00
db8500_thermal.c
devfreq_cooling.c
dove_thermal.c
fair_share.c
gov_bang_bang.c
hisi_thermal.c thermal/drivers/hisi: Remove bogus const from function return type 2018-01-02 10:44:58 -08:00
imx_thermal.c Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal 2018-08-16 10:21:18 -07:00
intel_bxt_pmic_thermal.c
intel_pch_thermal.c
intel_powerclamp.c treewide: correct "differenciate" and "instanciate" typos 2018-08-23 18:48:43 -07:00
intel_quark_dts_thermal.c
intel_soc_dts_iosf.c
intel_soc_dts_iosf.h
intel_soc_dts_thermal.c Thermal: Intel SoC DTS: Translate IO-APIC GSI number to linux irq number 2018-07-26 16:02:48 +08:00
Kconfig Thermal: Intel SoC DTS: Translate IO-APIC GSI number to linux irq number 2018-07-26 16:02:48 +08:00
kirkwood_thermal.c
Makefile
max77620_thermal.c
mtk_thermal.c thermal: mediatek: use of_device_get_match_data() 2018-05-06 16:53:47 -07:00
of-thermal.c thermal: of-thermal: disable passive polling when thermal zone is disabled 2018-08-20 12:00:40 -07:00
power_allocator.c
qcom-spmi-temp-alarm.c thermal: qcom-spmi-temp-alarm: add support for GEN2 PMIC peripherals 2018-06-01 14:22:28 -07:00
qoriq_thermal.c thermal: qoriq: Switch to SPDX identifier 2018-08-20 11:32:55 -07:00
rcar_gen3_thermal.c thermal: rcar_gen3_thermal: convert to SPDX identifiers 2018-08-20 11:42:35 -07:00
rcar_thermal.c thermal: rcar_thermal: Prevent doing work after unbind 2018-11-13 11:08:31 -08:00
rockchip_thermal.c
spear_thermal.c
step_wise.c
tango_thermal.c
thermal-generic-adc.c thermal: generic-adc: Fix adc to temp interpolation 2019-02-12 19:47:19 +01:00
thermal_core.c Thermal: do not clear passive state during system sleep 2019-02-12 19:47:03 +01:00
thermal_core.h drivers: thermal: Update license to SPDX format 2018-05-30 14:46:17 +08:00
thermal_helpers.c drivers: thermal: Update license to SPDX format 2018-05-30 14:46:17 +08:00
thermal_hwmon.c thermal_hwmon: Pass the originating device down to hwmon_device_register_with_info 2018-07-27 14:43:21 -07:00
thermal_hwmon.h thermal: hwmon: inline helpers when CONFIG_THERMAL_HWMON is not set 2019-02-12 19:47:21 +01:00
thermal_sysfs.c thermal: Fix locking in cooling device sysfs update cur_state 2019-02-12 19:47:03 +01:00
uniphier_thermal.c thermal: uniphier: add UniPhier PXs3 support 2018-05-06 14:46:08 -07:00
user_space.c
x86_pkg_temp_thermal.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
zx2967_thermal.c