Skip to content
Commit ac4436a5 authored by Ahmad Fatoum's avatar Ahmad Fatoum Committed by Rafael J. Wysocki
Browse files

thermal: of: fix double-free on unregistration

Since commit 3d439b1a ("thermal/core: Alloc-copy-free the thermal
zone parameters structure"), thermal_zone_device_register() allocates
a copy of the tzp argument and frees it when unregistering, so
thermal_of_zone_register() now ends up leaking its original tzp and
double-freeing the tzp copy. Fix this by locating tzp on stack instead.

Fixes: 3d439b1a

 ("thermal/core: Alloc-copy-free the thermal zone parameters structure")
Signed-off-by: default avatarAhmad Fatoum <a.fatoum@pengutronix.de>
Acked-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Cc: 6.4+ <stable@vger.kernel.org> # 6.4+: 8bcbb18c61d6: thermal: core: constify params in thermal_zone_device_register
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 80ddce5f
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment