Subject: CVE-2024-50027: thermal: core: Free tzp copy along with the thermal zone

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

thermal: core: Free tzp copy along with the thermal zone

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.

The Linux kernel CVE team has assigned CVE-2024-50027 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 6.4 with commit 3d439b1a2ad3 and fixed in 6.11.4 with commit bdb0d40507c8
	Issue introduced in 6.4 with commit 3d439b1a2ad3 and fixed in 6.12-rc3 with commit 827a07525c09

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2024-50027
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	drivers/thermal/thermal_core.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/bdb0d40507c85bee33c2a71fde7b2e857346f112
	https://git.kernel.org/stable/c/827a07525c099f54d3b15110408824541ec66b3c