drm/virtio: Check whether transferred 2D BO is shmem
authorDmitry Osipenko <dmitry.osipenko@collabora.com>
Thu, 30 Jun 2022 20:07:19 +0000 (23:07 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 10:34:23 +0000 (12:34 +0200)
commitf122bcb34f1a4b02ef3d95058d8fd1316ea03785
tree6837a3c0aa348ad4aef64d01cdba48a405e7cd9d
parenta95fb5d55af0bf7efcfe6818a5fef37d21d86d9d
drm/virtio: Check whether transferred 2D BO is shmem

commit e473216b42aa1fd9fc6b94b608b42c210c655908 upstream.

Transferred 2D BO always must be a shmem BO. Add check for that to prevent
NULL dereference if userspace passes a VRAM BO.

Cc: stable@vger.kernel.org
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20220630200726.1884320-3-dmitry.osipenko@collabora.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/virtio/virtgpu_vq.c