Subject: CVE-2024-39498: drm/mst: Fix NULL pointer dereference at drm_dp_add_payload_part2

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

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

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

drm/mst: Fix NULL pointer dereference at drm_dp_add_payload_part2

[Why]
Commit:
- commit 5aa1dfcdf0a4 ("drm/mst: Refactor the flow for payload allocation/removement")
accidently overwrite the commit
- commit 54d217406afe ("drm: use mgr->dev in drm_dbg_kms in drm_dp_add_payload_part2")
which cause regression.

[How]
Recover the original NULL fix and remove the unnecessary input parameter 'state' for
drm_dp_add_payload_part2().

(cherry picked from commit 4545614c1d8da603e57b60dd66224d81b6ffc305)

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

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

	Issue introduced in 6.7 with commit 5aa1dfcdf0a4 and fixed in 6.9.6 with commit 8e21de5f99b2
	Issue introduced in 6.7 with commit 5aa1dfcdf0a4 and fixed in 6.10 with commit 5a507b7d2be1

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-39498
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/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
	drivers/gpu/drm/display/drm_dp_mst_topology.c
	drivers/gpu/drm/i915/display/intel_dp_mst.c
	drivers/gpu/drm/nouveau/dispnv50/disp.c
	include/drm/display/drm_dp_mst_helper.h

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/8e21de5f99b2368a5155037ce0aae8aaba3f5241
	https://git.kernel.org/stable/c/5a507b7d2be15fddb95bf8dee01110b723e2bcd9