This is a note to let you know that I've just added the patch titled drm/virtio: Check whether transferred 2D BO is shmem to the 6.0-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: drm-virtio-check-whether-transferred-2d-bo-is-shmem.patch and it can be found in the queue-6.0 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From e473216b42aa1fd9fc6b94b608b42c210c655908 Mon Sep 17 00:00:00 2001 From: Dmitry Osipenko <dmitry.osipenko@xxxxxxxxxxxxx> Date: Thu, 30 Jun 2022 23:07:19 +0300 Subject: drm/virtio: Check whether transferred 2D BO is shmem From: Dmitry Osipenko <dmitry.osipenko@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx Reviewed-by: Emil Velikov <emil.l.velikov@xxxxxxxxx> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@xxxxxxxxxxxxx> Link: http://patchwork.freedesktop.org/patch/msgid/20220630200726.1884320-3-dmitry.osipenko@xxxxxxxxxxxxx Signed-off-by: Gerd Hoffmann <kraxel@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/virtio/virtgpu_vq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/virtio/virtgpu_vq.c +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c @@ -597,7 +597,7 @@ void virtio_gpu_cmd_transfer_to_host_2d( bool use_dma_api = !virtio_has_dma_quirk(vgdev->vdev); struct virtio_gpu_object_shmem *shmem = to_virtio_gpu_shmem(bo); - if (use_dma_api) + if (virtio_gpu_is_shmem(bo) && use_dma_api) dma_sync_sgtable_for_device(vgdev->vdev->dev.parent, shmem->pages, DMA_TO_DEVICE); Patches currently in stable-queue which might be from dmitry.osipenko@xxxxxxxxxxxxx are queue-6.0/drm-virtio-unlock-reservations-on-dma_resv_reserve_fences-error.patch queue-6.0/drm-virtio-check-whether-transferred-2d-bo-is-shmem.patch queue-6.0/drm-virtio-unlock-reservations-on-virtio_gpu_object_shmem_init-error.patch queue-6.0/drm-virtio-use-appropriate-atomic-state-in-virtio_gpu_plane_cleanup_fb.patch