Skip to content

Commit 5e5c9f9

Browse files
digetxdlezcano
authored andcommitted
thermal/core/thermal_of: Stop zone device before unregistering it
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
1 parent 1aab6b8 commit 5e5c9f9

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/thermal/thermal_of.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,9 @@ void thermal_zone_of_sensor_unregister(struct device *dev,
559559
if (!tz)
560560
return;
561561

562+
/* stop temperature polling */
563+
thermal_zone_device_disable(tzd);
564+
562565
mutex_lock(&tzd->lock);
563566
tzd->ops->get_temp = NULL;
564567
tzd->ops->get_trend = NULL;

0 commit comments

Comments
 (0)