Skip to content

Commit bdb0d40

Browse files
rafaeljwgregkh
authored andcommitted
thermal: core: Free tzp copy along with the thermal zone
commit 827a075 upstream. The object pointed to by tz->tzp may still be accessed after being freed in thermal_zone_device_unregister(), so move the freeing of it to the point after the removal completion has been completed at which it cannot be accessed any more. Fixes: 3d439b1 ("thermal/core: Alloc-copy-free the thermal zone parameters structure") Cc: 6.8+ <stable@vger.kernel.org> # 6.8+ Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> Link: https://patch.msgid.link/4623516.LvFx2qVVIh@rjwysocki.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c95538b commit bdb0d40

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

drivers/thermal/thermal_core.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,14 +1647,12 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
16471647
ida_destroy(&tz->ida);
16481648

16491649
device_del(&tz->device);
1650-
1651-
kfree(tz->tzp);
1652-
16531650
put_device(&tz->device);
16541651

16551652
thermal_notify_tz_delete(tz);
16561653

16571654
wait_for_completion(&tz->removal);
1655+
kfree(tz->tzp);
16581656
kfree(tz);
16591657
}
16601658
EXPORT_SYMBOL_GPL(thermal_zone_device_unregister);

0 commit comments

Comments
 (0)