mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
thermal/core/thermal_of: Stop zone device before unregistering it
[ Upstream commit 5e5c9f9a75 ]
Zone device is enabled after thermal_zone_of_sensor_register() completion,
but it's not disabled before senor is unregistered, leaving temperature
polling active. This results in accessing a disabled zone device and
produces a warning about this problem. Stop zone device before
unregistering it in order to fix this "use-after-free" problem.
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20210616190417.32214-3-digetx@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
7412c988fe
commit
9beba14699
|
|
@ -559,6 +559,9 @@ void thermal_zone_of_sensor_unregister(struct device *dev,
|
||||||
if (!tz)
|
if (!tz)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* stop temperature polling */
|
||||||
|
thermal_zone_device_disable(tzd);
|
||||||
|
|
||||||
mutex_lock(&tzd->lock);
|
mutex_lock(&tzd->lock);
|
||||||
tzd->ops->get_temp = NULL;
|
tzd->ops->get_temp = NULL;
|
||||||
tzd->ops->get_trend = NULL;
|
tzd->ops->get_trend = NULL;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user