]> git.baikalelectronics.ru Git - kernel.git/commit
drm/virtio: Fix GEM handle creation UAF
authorRob Clark <robdclark@chromium.org>
Fri, 16 Dec 2022 23:33:55 +0000 (15:33 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:42:05 +0000 (11:42 +0100)
commit0a1a26cc73b0d449d2b51f12536c7c13bf15fbd9
treea776bdc9c1636ebd3c7c38c2b8af3b4adfc100f1
parentc30fd11eae26c1252bab3a644a48555ba06c0460
drm/virtio: Fix GEM handle creation UAF

[ Upstream commit 52531258318ed59a2dc5a43df2eaf0eb1d65438e ]

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.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Fixes: 02e398c17c39 ("virtio-gpu: add 3d/virgl support")
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221216233355.542197-2-robdclark@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/virtio/virtgpu_ioctl.c