Subject: CVE-2024-42309: drm/gma500: fix null pointer dereference in psb_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 psb_intel_lvds_get_modes

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

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

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

	Issue introduced in 3.3 with commit 89c78134cc54 and fixed in 4.19.320 with commit 13b5f3ee94bd
	Issue introduced in 3.3 with commit 89c78134cc54 and fixed in 5.4.282 with commit d6ad202f73f8
	Issue introduced in 3.3 with commit 89c78134cc54 and fixed in 5.10.224 with commit 6735d02ead7d
	Issue introduced in 3.3 with commit 89c78134cc54 and fixed in 5.15.165 with commit 7e52c62ff029
	Issue introduced in 3.3 with commit 89c78134cc54 and fixed in 6.1.103 with commit f70ffeca5464
	Issue introduced in 3.3 with commit 89c78134cc54 and fixed in 6.6.44 with commit 46d2ef272957
	Issue introduced in 3.3 with commit 89c78134cc54 and fixed in 6.10.3 with commit 475a5b3b7c8e
	Issue introduced in 3.3 with commit 89c78134cc54 and fixed in 6.11 with commit 2df7aac81070

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-42309
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/psb_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/13b5f3ee94bdbdc4b5f40582aab62977905aedee
	https://git.kernel.org/stable/c/d6ad202f73f8edba0cbc0065aa57a79ffe8fdcdc
	https://git.kernel.org/stable/c/6735d02ead7dd3adf74eb8b70aebd09e0ce78ec9
	https://git.kernel.org/stable/c/7e52c62ff029f95005915c0a11863b5fb5185c8c
	https://git.kernel.org/stable/c/f70ffeca546452d1acd3a70ada56ecb2f3e7f811
	https://git.kernel.org/stable/c/46d2ef272957879cbe30a884574320e7f7d78692
	https://git.kernel.org/stable/c/475a5b3b7c8edf6e583a9eb59cf28ea770602e14
	https://git.kernel.org/stable/c/2df7aac81070987b0f052985856aa325a38debf6