]> git.proxmox.com Git - mirror_ubuntu-kernels.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)
committerDmitry Osipenko <dmitry.osipenko@collabora.com>
Mon, 9 Jan 2023 23:17:50 +0000 (02:17 +0300)
commit52531258318ed59a2dc5a43df2eaf0eb1d65438e
tree6cc50280fa286f3ae4ebb2d577ca72d8a96653f3
parent0688773f0710528e1ab302c3d6317e269f2e2e6e
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.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Fixes: 62fb7a5e1096 ("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
drivers/gpu/drm/virtio/virtgpu_ioctl.c