linux/drivers/thermal
Mikhail Lappo f874c2de5d thermal: imx: Fix race condition in imx_thermal_probe()
commit cf1ba1d73a upstream.

When device boots with T > T_trip_1 and requests interrupt,
the race condition takes place. The interrupt comes before
THERMAL_DEVICE_ENABLED is set. This leads to an attempt to
reading sensor value from irq and disabling the sensor, based on
the data->mode field, which expected to be THERMAL_DEVICE_ENABLED,
but still stays as THERMAL_DEVICE_DISABLED. Afher this issue
sensor is never re-enabled, as the driver state is wrong.

Fix this problem by setting the 'data' members prior to
requesting the interrupts.

Fixes: 37713a1e8e ("thermal: imx: implement thermal alarm interrupt handling")
Signed-off-by: Mikhail Lappo <mikhail.lappo@esrlabs.com>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2018-10-21 08:44:55 +01:00
..
samsung thermal: exynos: Fix unbalanced regulator disable on probe failure 2015-12-13 17:49:07 +00:00
ti-soc-thermal thermal: ti-soc-thermal: ti-bandgap.c: Cleaning up wrong address is checked 2014-07-01 09:52:35 +08:00
armada_thermal.c thermal: armada: Update Armada 380 thermal sensor coefficients 2015-06-02 12:08:12 +01:00
cpu_cooling.c thermal: cpu_cooling: Use cpufreq_for_each_valid_entry macro for iteration 2014-04-30 00:06:49 +02:00
db8500_cpufreq_cooling.c thermal: db8500_cpufreq_cooling: remove usage of IS_ERR_OR_NULL() 2013-04-27 09:28:38 +08:00
db8500_thermal.c thermal: db8500: Fix missing mutex_unlock() in probe error paths 2013-03-26 22:08:08 +08:00
dove_thermal.c Merge branches 'misc', 'drv_cleanup', 'devm-cleanup' and 'ti-soc' of .git into next 2013-05-28 10:46:46 +08:00
fair_share.c Thermal: build thermal governors into thermal_sys module 2013-04-14 23:28:43 +08:00
imx_thermal.c thermal: imx: Fix race condition in imx_thermal_probe() 2018-10-21 08:44:55 +01:00
int3403_thermal.c Thermal/int3403: Fix thermal hysteresis unit conversion 2014-05-15 16:38:48 +08:00
intel_powerclamp.c tick/powerclamp: Remove tick_nohz_idle abuse 2015-01-15 10:44:41 +00:00
intel_soc_dts_thermal.c thermal: Intel SoC DTS thermal 2014-05-15 16:37:24 +08:00
Kconfig Merge branches 'armada-375-380-soc-support', 'eduardo-thermal-soc-fixes', 'intel-soc-dts-thermal' and 'thermal-soc-fixes' of .git into next 2014-05-15 17:18:02 +08:00
kirkwood_thermal.c Merge branches 'misc', 'drv_cleanup', 'devm-cleanup' and 'ti-soc' of .git into next 2013-05-28 10:46:46 +08:00
Makefile thermal: Intel SoC DTS thermal 2014-05-15 16:37:24 +08:00
of-thermal.c thermal: Bind cooling devices with the correct arguments 2014-06-30 10:20:27 +08:00
rcar_thermal.c thermal: rcar: remove unnecessary OOM messages 2014-05-15 17:15:26 +08:00
spear_thermal.c thermal: spear: remove unnecessary OOM messages 2014-05-15 17:15:26 +08:00
step_wise.c thermal: step_wise: fix: Prevent from binary overflow when trend is dropping 2015-08-10 09:54:04 +01:00
thermal_core.c thermal: Fix error path in thermal_init() 2015-01-15 10:43:37 +00:00
thermal_core.h thermal: introduce device tree parser 2013-12-04 09:31:34 -04:00
thermal_hwmon.c thermal: hwmon: Properly report critical temperature in sysfs 2017-03-16 02:26:26 +00:00
thermal_hwmon.h thermal: hwmon: move hwmon support to single file 2013-09-03 09:09:12 -04:00
user_space.c Thermal: build thermal governors into thermal_sys module 2013-04-14 23:28:43 +08:00
x86_pkg_temp_thermal.c thermal, x86-pkg-temp: Fix CPU hotplug callback registration 2014-03-20 13:43:47 +01:00