Subject: CVE-2024-49992: drm/stm: Avoid use-after-free issues with crtc and plane

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

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

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

drm/stm: Avoid use-after-free issues with crtc and plane

ltdc_load() calls functions drm_crtc_init_with_planes(),
drm_universal_plane_init() and drm_encoder_init(). These functions
should not be called with parameters allocated with devm_kzalloc()
to avoid use-after-free issues [1].

Use allocations managed by the DRM framework.

Found by Linux Verification Center (linuxtesting.org).

[1]
https://lore.kernel.org/lkml/u366i76e3qhh3ra5oxrtngjtm2u5lterkekcz6y2jkndhuxzli@diujon4h7qwb/

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

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

	Fixed in 6.1.113 with commit d02611ff0014
	Fixed in 6.6.55 with commit 0a1741d10da2
	Fixed in 6.10.14 with commit 454e5d7e6719
	Fixed in 6.11.3 with commit b22eec4b57d0
	Fixed in 6.12-rc1 with commit 19dd9780b7ac

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-49992
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/gpu/drm/stm/drv.c
	drivers/gpu/drm/stm/ltdc.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/d02611ff001454358be6910cb926799e2d818716
	https://git.kernel.org/stable/c/0a1741d10da29aa84955ef89ae9a03c4b6038657
	https://git.kernel.org/stable/c/454e5d7e671946698af0f201e48469e5ddb42851
	https://git.kernel.org/stable/c/b22eec4b57d04befa90e8554ede34e6c67257606
	https://git.kernel.org/stable/c/19dd9780b7ac673be95bf6fd6892a184c9db611f