Subject: CVE-2024-41095: drm/nouveau/dispnv04: fix null pointer dereference in nv17_tv_get_ld_modes

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

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

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

drm/nouveau/dispnv04: fix null pointer dereference in nv17_tv_get_ld_modes

In nv17_tv_get_ld_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-41095 to this issue.

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

	Fixed in 4.19.317 with commit 9289cd3450d1
	Fixed in 5.4.279 with commit dbd75f322525
	Fixed in 5.10.221 with commit 259549b2ccf7
	Fixed in 5.15.162 with commit 0d17604f2e44
	Fixed in 6.1.97 with commit f95ed0f54b3d
	Fixed in 6.6.37 with commit cb751e48bbcf
	Fixed in 6.9.8 with commit bdda5072494f
	Fixed in 6.10 with commit 66edf3fb331b

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-41095
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/dispnv04/tvnv17.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/9289cd3450d1da3e271ef4b054d4d2932c41243e
	https://git.kernel.org/stable/c/dbd75f32252508ed6c46c3288a282c301a57ceeb
	https://git.kernel.org/stable/c/259549b2ccf795b7f91f7b5aba47286addcfa389
	https://git.kernel.org/stable/c/0d17604f2e44b3df21e218fe8fb3b836d41bac49
	https://git.kernel.org/stable/c/f95ed0f54b3d3faecae1140ddab854f904a6e7c8
	https://git.kernel.org/stable/c/cb751e48bbcffd292090f7882b23b215111b3d72
	https://git.kernel.org/stable/c/bdda5072494f2a7215d94fc4124ad1949a218714
	https://git.kernel.org/stable/c/66edf3fb331b6c55439b10f9862987b0916b3726