Subject: CVE-2024-42101: drm/nouveau: fix null pointer dereference in nouveau_connector_get_modes

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

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

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

drm/nouveau: fix null pointer dereference in nouveau_connector_get_modes

In nouveau_connector_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-42101 to this issue.

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

	Issue introduced in 2.6.33 with commit 6ee738610f41 and fixed in 4.19.318 with commit 9baf60323efa
	Issue introduced in 2.6.33 with commit 6ee738610f41 and fixed in 5.4.280 with commit e36364f5f378
	Issue introduced in 2.6.33 with commit 6ee738610f41 and fixed in 5.10.222 with commit 274cba8d2d1b
	Issue introduced in 2.6.33 with commit 6ee738610f41 and fixed in 5.15.163 with commit f48dd3f19614
	Issue introduced in 2.6.33 with commit 6ee738610f41 and fixed in 6.1.98 with commit 1f3253523849
	Issue introduced in 2.6.33 with commit 6ee738610f41 and fixed in 6.6.39 with commit 744b229f0913
	Issue introduced in 2.6.33 with commit 6ee738610f41 and fixed in 6.9.9 with commit 7db5411c5d0b
	Issue introduced in 2.6.33 with commit 6ee738610f41 and fixed in 6.10 with commit 80bec6825b19

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-42101
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/nouveau/nouveau_connector.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/9baf60323efa992b7c915094529f0a1882c34e7e
	https://git.kernel.org/stable/c/e36364f5f3785d054a94e57e971385284886d41a
	https://git.kernel.org/stable/c/274cba8d2d1b48c72d8bd90e76c9e2dc1aa0a81d
	https://git.kernel.org/stable/c/f48dd3f19614022f2e1b794fbd169d2b4c398c07
	https://git.kernel.org/stable/c/1f32535238493008587a8c5cb17eb2ca097592ef
	https://git.kernel.org/stable/c/744b229f09134ccd091427a6f9ea6d97302cfdd9
	https://git.kernel.org/stable/c/7db5411c5d0bd9c29b8c2ad93c36b5c16ea46c9e
	https://git.kernel.org/stable/c/80bec6825b19d95ccdfd3393cf8ec15ff2a749b4