Subject: CVE-2023-52815: drm/amdgpu/vkms: fix a possible null pointer dereference

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

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

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

drm/amdgpu/vkms: fix a possible null pointer dereference

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

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

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

	Fixed in 5.15.140 with commit eaa03ea366c8
	Fixed in 6.1.64 with commit 33fb1a555354
	Fixed in 6.5.13 with commit 8c6c85a07376
	Fixed in 6.6.3 with commit 70f831f21155
	Fixed in 6.7 with commit cd90511557fd

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-52815
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/amdgpu/amdgpu_vkms.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/eaa03ea366c85ae3cb69c8d4bbc67c8bc2167a27
	https://git.kernel.org/stable/c/33fb1a555354bd593f785935ddcb5d9dd4d3847f
	https://git.kernel.org/stable/c/8c6c85a073768df68c1a3fea143d013a38c66d34
	https://git.kernel.org/stable/c/70f831f21155c692bb336c434936fd6f24f3f81a
	https://git.kernel.org/stable/c/cd90511557fdfb394bb4ac4c3b539b007383914c