drm/virtio: Don't return invalid caps on timeout
authorTomeu Vizoso <tomeu.vizoso@collabora.com>
Mon, 27 Nov 2017 14:21:25 +0000 (15:21 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Thu, 1 Feb 2018 16:45:41 +0000 (17:45 +0100)
If the wait timeouts, the caps are probably invalid and we shouldn't be
passing them to userspace.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20171127142126.25765-1-tomeu.vizoso@collabora.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
drivers/gpu/drm/virtio/virtgpu_ioctl.c

index 5720a0d4ac0a9ebf242755921bc1ac6fea8c2630..355569a9b5cbef4fa2216231b4aed4fc0f8dd6bd 100644 (file)
@@ -518,6 +518,8 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
 
        ret = wait_event_timeout(vgdev->resp_wq,
                                 atomic_read(&cache_ent->is_valid), 5 * HZ);
+       if (!ret)
+               return -EBUSY;
 
        ptr = cache_ent->caps_cache;