Subject: CVE-2022-48899: drm/virtio: Fix GEM handle creation UAF

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

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

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

drm/virtio: Fix GEM handle creation UAF

Userspace can guess the handle value and try to race GEM object creation
with handle close, resulting in a use-after-free if we dereference the
object after dropping the handle's reference.  For that reason, dropping
the handle's reference must be done *after* we are done dereferencing
the object.

The Linux kernel CVE team has assigned CVE-2022-48899 to this issue.

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

	Issue introduced in 4.4 with commit 62fb7a5e1096 and fixed in 4.19.270 with commit 19ec87d06acf
	Issue introduced in 4.4 with commit 62fb7a5e1096 and fixed in 5.4.229 with commit d01d6d2b06c0
	Issue introduced in 4.4 with commit 62fb7a5e1096 and fixed in 5.10.164 with commit 68bcd0638570
	Issue introduced in 4.4 with commit 62fb7a5e1096 and fixed in 5.15.89 with commit 011ecdbcd520
	Issue introduced in 4.4 with commit 62fb7a5e1096 and fixed in 6.1.7 with commit adc48e5e408a
	Issue introduced in 4.4 with commit 62fb7a5e1096 and fixed in 6.2 with commit 52531258318e

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-2022-48899
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/virtio/virtgpu_ioctl.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/19ec87d06acfab2313ee82b2a689bf0c154e57ea
	https://git.kernel.org/stable/c/d01d6d2b06c0d8390adf8f3ba08aa60b5642ef73
	https://git.kernel.org/stable/c/68bcd063857075d2f9edfed6024387ac377923e2
	https://git.kernel.org/stable/c/011ecdbcd520c90c344b872ca6b4821f7783b2f8
	https://git.kernel.org/stable/c/adc48e5e408afbb01d261bd303fd9fbbbaa3e317
	https://git.kernel.org/stable/c/52531258318ed59a2dc5a43df2eaf0eb1d65438e