Subject: CVE-2024-38627: stm class: Fix a double free in stm_register_device()

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

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

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

stm class: Fix a double free in stm_register_device()

The put_device(&stm->dev) call will trigger stm_device_release() which
frees "stm" so the vfree(stm) on the next line is a double free.

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

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

	Issue introduced in 4.7 with commit 389b6699a2aa and fixed in 4.19.316 with commit 6cc30ef8eb6d
	Issue introduced in 4.7 with commit 389b6699a2aa and fixed in 5.4.278 with commit a0450d3f38e7
	Issue introduced in 4.7 with commit 389b6699a2aa and fixed in 5.10.219 with commit 713fc00c571d
	Issue introduced in 4.7 with commit 389b6699a2aa and fixed in 5.15.161 with commit 7419df1acffb
	Issue introduced in 4.7 with commit 389b6699a2aa and fixed in 6.1.93 with commit 4bfd48bb6e62
	Issue introduced in 4.7 with commit 389b6699a2aa and fixed in 6.6.33 with commit 370c480410f6
	Issue introduced in 4.7 with commit 389b6699a2aa and fixed in 6.9.4 with commit d782a2db8f7a
	Issue introduced in 4.7 with commit 389b6699a2aa and fixed in 6.10 with commit 3df463865ba4
	Issue introduced in 4.4.178 with commit b0351a51ffda

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-38627
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/hwtracing/stm/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/6cc30ef8eb6d8f8d6df43152264bbf8835d99931
	https://git.kernel.org/stable/c/a0450d3f38e7c6c0a7c0afd4182976ee15573695
	https://git.kernel.org/stable/c/713fc00c571dde4af3db2dbd5d1b0eadc327817b
	https://git.kernel.org/stable/c/7419df1acffbcc90037f6b5a2823e81389659b36
	https://git.kernel.org/stable/c/4bfd48bb6e62512b9c392c5002c11e1e3b18d247
	https://git.kernel.org/stable/c/370c480410f60b90ba3e96abe73ead21ec827b20
	https://git.kernel.org/stable/c/d782a2db8f7ac49c33b9ca3e835500a28667d1be
	https://git.kernel.org/stable/c/3df463865ba42b8f88a590326f4c9ea17a1ce459