android_kernel_oneplus_msm8998/drivers/thermal
Mikhail Lappo 8af69306a7 thermal: imx: Fix race condition in imx_thermal_probe()
commit cf1ba1d73a33944d8c1a75370a35434bf146b8a7 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")
Cc: <stable@vger.kernel.org>
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-24 09:32:08 +02:00
..
int340x_thermal thermal: consistently use int for temperatures 2015-08-03 23:15:50 +08:00
samsung Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux 2015-11-11 09:03:01 -08:00
st Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux 2015-09-11 16:13:47 -07:00
ti-soc-thermal thermal: ti-soc-thermal: add OMAP36xx support 2015-09-29 14:13:19 -07:00
armada_thermal.c thermal: armada: Fix possible overflow in the Armada 380 thermal sensor formula 2015-10-30 11:33:23 -07:00
clock_cooling.c
cpu_cooling.c thermal: cpu_cooling: Avoid accessing potentially freed structures 2017-07-27 15:06:02 -07:00
db8500_cpufreq_cooling.c thermal: db8500_cpufreq_cooling: Fix module autoload for OF platform driver 2015-09-13 20:26:19 -07:00
db8500_thermal.c thermal: consistently use int for temperatures 2015-08-03 23:15:50 +08:00
devfreq_cooling.c devfreq_cooling: return on allocation failure 2015-11-04 11:06:29 -08:00
dove_thermal.c thermal: consistently use int for temperatures 2015-08-03 23:15:50 +08:00
fair_share.c thermal: consistently use int for temperatures 2015-08-03 23:15:50 +08:00
gov_bang_bang.c thermal: consistently use int for temperatures 2015-08-03 23:15:50 +08:00
hisi_thermal.c thermal: hisilicon: Handle return value of clk_prepare_enable 2017-12-25 14:22:15 +01:00
imx_thermal.c thermal: imx: Fix race condition in imx_thermal_probe() 2018-04-24 09:32:08 +02:00
intel_pch_thermal.c thermal: fix intel PCH thermal driver mismerge 2015-09-11 20:06:59 -07:00
intel_powerclamp.c Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux 2015-09-11 16:13:47 -07:00
intel_quark_dts_thermal.c thermal: consistently use int for temperatures 2015-08-03 23:15:50 +08:00
intel_soc_dts_iosf.c thermal: consistently use int for temperatures 2015-08-03 23:15:50 +08:00
intel_soc_dts_iosf.h
intel_soc_dts_thermal.c
Kconfig thermal: fix INTEL_SOC_DTS_IOSF_CORE dependencies 2018-02-25 11:03:43 +01:00
kirkwood_thermal.c thermal: consistently use int for temperatures 2015-08-03 23:15:50 +08:00
Makefile thermal: Add devfreq cooling 2015-10-30 10:21:01 -07:00
of-thermal.c thermal: of-thermal: Reduce log level for message when can't fine thermal zone 2015-11-16 10:49:17 -08:00
power_allocator.c thermal: power_allocator: fix one race condition issue for thermal_instances list 2018-04-13 19:50:12 +02:00
qcom-spmi-temp-alarm.c thermal: consistently use int for temperatures 2015-08-03 23:15:50 +08:00
rcar_thermal.c thermal: rcar_thermal: remove redundant operation 2015-11-16 10:53:08 -08:00
rockchip_thermal.c thermal: rockchip: fix a impossible condition caused by the warning 2016-05-04 14:48:54 -07:00
spear_thermal.c thermal: spear: use __maybe_unused for PM functions 2018-02-25 11:03:44 +01:00
step_wise.c thermal/drivers/step_wise: Fix temperature regulation misbehavior 2017-12-20 10:04:59 +01:00
tegra_soctherm.c thermal: consistently use int for temperatures 2015-08-03 23:15:50 +08:00
thermal_core.c Thermal: Ignore invalid trip points 2016-04-12 09:08:35 -07:00
thermal_core.h Thermal: initialize thermal zone device correctly 2016-03-03 15:07:25 -08:00
thermal_hwmon.c thermal: hwmon: Properly report critical temperature in sysfs 2017-01-09 08:07:44 +01:00
thermal_hwmon.h
user_space.c
x86_pkg_temp_thermal.c thermal: consistently use int for temperatures 2015-08-03 23:15:50 +08:00