Skip to content

Commit

Permalink
drm/virtio: Correct drm_gem_shmem_get_sg_table() error handling
Browse files Browse the repository at this point in the history
[ Upstream commit 64b88af ]

Previous commit fixed checking of the ERR_PTR value returned by
drm_gem_shmem_get_sg_table(), but it missed to zero out the shmem->pages,
which will crash virtio_gpu_cleanup_object(). Add the missing zeroing of
the shmem->pages.

Fixes: c249687 ("drm/virtio: Fix NULL vs IS_ERR checking in virtio_gpu_object_shmem_init")
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-2-dmitry.osipenko@collabora.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
digetx authored and gregkh committed Oct 21, 2022
1 parent cfecfc9 commit bcb8e14
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/gpu/drm/virtio/virtgpu_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ static int virtio_gpu_object_shmem_init(struct virtio_gpu_device *vgdev,
shmem->pages = drm_gem_shmem_get_sg_table(&bo->base);
if (IS_ERR(shmem->pages)) {
drm_gem_shmem_unpin(&bo->base);
shmem->pages = NULL;
return PTR_ERR(shmem->pages);
}

Expand Down

0 comments on commit bcb8e14

Please sign in to comment.