Subject: CVE-2023-52821: drm/panel: fix a possible null pointer dereference

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

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

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

drm/panel: fix a possible null pointer dereference

In versatile_panel_get_modes(), the return value of drm_mode_duplicate()
is assigned to mode, which will lead to a NULL pointer dereference
on failure of drm_mode_duplicate(). Add a check to avoid npd.

The Linux kernel CVE team has assigned CVE-2023-52821 to this issue.

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

	Fixed in 5.10.202 with commit c7dc0aca5962
	Fixed in 5.15.140 with commit 2381f6b628b3
	Fixed in 6.1.64 with commit 79813cd59398
	Fixed in 6.5.13 with commit 4fa930ba046d
	Fixed in 6.6.3 with commit 8a9dd36fcb4f
	Fixed in 6.7 with commit 924e5814d1f8

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-2023-52821
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/panel/panel-arm-versatile.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/c7dc0aca5962fb37dbea9769dd26ec37813faae1
	https://git.kernel.org/stable/c/2381f6b628b3214f07375e0adf5ce17093c31190
	https://git.kernel.org/stable/c/79813cd59398015867d51e6d7dcc14d287d4c402
	https://git.kernel.org/stable/c/4fa930ba046d20fc1899770396ee11e905fa96e4
	https://git.kernel.org/stable/c/8a9dd36fcb4f3906982b82593393578db4479992
	https://git.kernel.org/stable/c/924e5814d1f84e6fa5cb19c6eceb69f066225229