Subject: CVE-2024-42310: drm/gma500: fix null pointer dereference in cdv_intel_lvds_get_modes

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

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

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

drm/gma500: fix null pointer dereference in cdv_intel_lvds_get_modes

In cdv_intel_lvds_get_modes(), the return value of drm_mode_duplicate()
is assigned to mode, which will lead to a NULL pointer dereference on
failure of drm_mode_duplicate(). Add a check to avoid npd.

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

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

	Issue introduced in 3.3 with commit 6a227d5fd6c4 and fixed in 4.19.320 with commit f392c36cebf4
	Issue introduced in 3.3 with commit 6a227d5fd6c4 and fixed in 5.4.282 with commit a658ae2173ab
	Issue introduced in 3.3 with commit 6a227d5fd6c4 and fixed in 5.10.224 with commit b6ac46a00188
	Issue introduced in 3.3 with commit 6a227d5fd6c4 and fixed in 5.15.165 with commit 08f45102c81a
	Issue introduced in 3.3 with commit 6a227d5fd6c4 and fixed in 6.1.103 with commit e74eb5e80894
	Issue introduced in 3.3 with commit 6a227d5fd6c4 and fixed in 6.6.44 with commit 2d209b2f862f
	Issue introduced in 3.3 with commit 6a227d5fd6c4 and fixed in 6.10.3 with commit 977ee4fe895e
	Issue introduced in 3.3 with commit 6a227d5fd6c4 and fixed in 6.11 with commit cb520c3f366c

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-42310
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/gma500/cdv_intel_lvds.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/f392c36cebf4c1d6997a4cc2c0f205254acef42a
	https://git.kernel.org/stable/c/a658ae2173ab74667c009e2550455e6de5b33ddc
	https://git.kernel.org/stable/c/b6ac46a00188cde50ffba233e6efb366354a1de5
	https://git.kernel.org/stable/c/08f45102c81ad8bc9f85f7a25e9f64e128edb87d
	https://git.kernel.org/stable/c/e74eb5e8089427c8c49e0dd5067e5f39ce3a4d56
	https://git.kernel.org/stable/c/2d209b2f862f6b8bff549ede541590a8d119da23
	https://git.kernel.org/stable/c/977ee4fe895e1729cd36cc26916bbb10084713d6
	https://git.kernel.org/stable/c/cb520c3f366c77e8d69e4e2e2781a8ce48d98e79