Subject: CVE-2024-49913: drm/amd/display: Add null check for top_pipe_to_program in commit_planes_for_stream

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

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

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

drm/amd/display: Add null check for top_pipe_to_program in commit_planes_for_stream

This commit addresses a null pointer dereference issue in the
`commit_planes_for_stream` function at line 4140. The issue could occur
when `top_pipe_to_program` is null.

The fix adds a check to ensure `top_pipe_to_program` is not null before
accessing its stream_res. This prevents a null pointer dereference.

Reported by smatch:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:4140 commit_planes_for_stream() error: we previously assumed 'top_pipe_to_program' could be null (see line 3906)

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

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

	Fixed in 5.10.227 with commit 1ebfa6663807
	Fixed in 5.15.168 with commit 8ab59527852a
	Fixed in 6.1.113 with commit 40193ff73630
	Fixed in 6.6.55 with commit e47e563c6f0d
	Fixed in 6.10.14 with commit 3929e382e475
	Fixed in 6.11.3 with commit 73efd2a611b6
	Fixed in 6.12-rc1 with commit 66d71a72539e

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-49913
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/dc/core/dc.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/1ebfa6663807c144be8c8b6727375012409d2356
	https://git.kernel.org/stable/c/8ab59527852a6f7780aad6185729550ca0569122
	https://git.kernel.org/stable/c/40193ff73630adf76bc0d82398f7d90fb576dba4
	https://git.kernel.org/stable/c/e47e563c6f0db7d792a559301862c19ead0dfc2f
	https://git.kernel.org/stable/c/3929e382e4758aff42da0102a60d13337c99d3b8
	https://git.kernel.org/stable/c/73efd2a611b62fee71a7b7f27d9d08bb60da8a72
	https://git.kernel.org/stable/c/66d71a72539e173a9b00ca0b1852cbaa5f5bf1ad