drm/virtio: locking/reservation fixes
Subsystems (4)
Gerd Hoffmann
maintainerPATCH 1/2 drm/virtio: fix virtio_gpu_execbuffer_ioctl locking
In reply to Gerd HoffmannLockdep says we can't call vmemdup() while having objects reserved because it needs the mmap semaphore. So reorder the calls reserve the objects later.
--- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/virtio/virtgpu_ioctl.c +10 -10
@@ -126,22 +126,22 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data, bo_handles =NULL ; } -if (buflist) { - ret =virtio_gpu_array_lock_resv (buflist); -if (ret) - goto out_unused_fd; - } - buf =vmemdup_user (u64_to_user_ptr (exbuf->command), exbuf->size);if (IS_ERR (buf)) { ret =PTR_ERR (buf); - goto out_unresv; + goto out_unused_fd; + } + +if (buflist) { + ret =virtio_gpu_array_lock_resv (buflist); +if (ret) + goto out_memdup; } out_fence =virtio_gpu_fence_alloc (vgdev);if (!out_fence) { ret = -ENOMEM ; - goto out_memdup; + goto out_unresv; }if (out_fence_fd >=0 ) {
@@ -160,11 +160,11 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data, vfpriv->ctx_id, buflist, out_fence);return 0 ; -out_memdup: -kvfree (buf); out_unresv:if (buflist)virtio_gpu_array_unlock_resv (buflist); +out_memdup: +kvfree (buf); out_unused_fd:kvfree (bo_handles);if (buflist)
Signature · 1 line
2.18.2
Gerd Hoffmann
maintainerPATCH 2/2 drm/virtio: fix virtio_gpu_cursor_plane_update().
In reply to Gerd HoffmannAdd missing virtio_gpu_array_lock_resv() call.
--- drivers/gpu/drm/virtio/virtgpu_plane.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/virtio/virtgpu_plane.c +1 -0
@@ -260,6 +260,7 @@ static void virtio_gpu_cursor_plane_update(struct drm_plane *plane,if (!objs)return ;virtio_gpu_array_add_obj (objs, vgfb->base.obj[0 ]); +virtio_gpu_array_lock_resv (objs); virtio_gpu_cmd_transfer_to_host_2d (vgdev, 0, plane->state->crtc_w,
Signature · 1 line
2.18.2
Gerd Hoffmann
maintainercover drm/virtio: locking/reservation fixes
Gerd Hoffmann (2):
drm/virtio: fix virtio_gpu_execbuffer_ioctl locking drm/virtio: fix virtio_gpu_cursor_plane_update().
drivers/gpu/drm/virtio/virtgpu_ioctl.c | 20 ++++++++++---------- drivers/gpu/drm/virtio/virtgpu_plane.c | 1 + 2 files changed, 11 insertions(+), 10 deletions(-)
Signature · 6 lines
2.18.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
The fixes look reasonable.
Quoted 7 lines · Gerd Hoffmann
Gerd Hoffmann (2):
drm/virtio: fixvirtio_gpu_execbuffer_ioctllocking drm/virtio: fixvirtio_gpu_cursor_plane_update().
Quoted 7 lines
drivers/gpu/drm/virtio/virtgpu_ioctl.c | 20 ++++++++++---------- drivers/gpu/drm/virtio/virtgpu_plane.c | 1 + 2 files changed, 11 insertions(+), 10 deletions(-)--
2.18.2
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel