Subject: CVE-2024-26667: drm/msm/dpu: check for valid hw_pp in dpu_encoder_helper_phys_cleanup

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

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

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

drm/msm/dpu: check for valid hw_pp in dpu_encoder_helper_phys_cleanup

The commit 8b45a26f2ba9 ("drm/msm/dpu: reserve cdm blocks for writeback
in case of YUV output") introduced a smatch warning about another
conditional block in dpu_encoder_helper_phys_cleanup() which had assumed
hw_pp will always be valid which may not necessarily be true.

Lets fix the other conditional block by making sure hw_pp is valid
before dereferencing it.

Patchwork: https://patchwork.freedesktop.org/patch/574878/

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

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

	Issue introduced in 5.19 with commit ae4d721ce100 and fixed in 6.1.78 with commit fb8bfc6ea3cd
	Issue introduced in 5.19 with commit ae4d721ce100 and fixed in 6.6.17 with commit 79592a6e7bdc
	Issue introduced in 5.19 with commit ae4d721ce100 and fixed in 6.7.5 with commit eb4f56f3ff57
	Issue introduced in 5.19 with commit ae4d721ce100 and fixed in 6.8 with commit 7f3d03c48b1e

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-26667
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/msm/disp/dpu1/dpu_encoder.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/fb8bfc6ea3cd8c5ac3d35711d064e2f6646aec17
	https://git.kernel.org/stable/c/79592a6e7bdc1d05460c95f891f5e5263a107af8
	https://git.kernel.org/stable/c/eb4f56f3ff5799ca754ae6d811803a63fe25a4a2
	https://git.kernel.org/stable/c/7f3d03c48b1eb6bc45ab20ca98b8b11be25f9f52