[PATCH 01/11] drm/virtio: fix a wait_event condition

Chia-I Wu olvaffe at gmail.com
Wed Feb 5 18:19:45 UTC 2020


outcnt may be greater than 1 since commit e1218b8c0cc1 (drm/virtio:
Use vmalloc for command buffer allocations.).

Signed-off-by: Chia-I Wu <olvaffe at gmail.com>
Cc: David Riley <davidriley at chromium.org>
---
 drivers/gpu/drm/virtio/virtgpu_vq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c
index 5914e79d3429f..5169e8dd9fd6c 100644
--- a/drivers/gpu/drm/virtio/virtgpu_vq.c
+++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
@@ -391,7 +391,8 @@ static void virtio_gpu_queue_fenced_ctrl_buffer(struct virtio_gpu_device *vgdev,
 	 */
 	if (vq->num_free < 2 + outcnt) {
 		spin_unlock(&vgdev->ctrlq.qlock);
-		wait_event(vgdev->ctrlq.ack_queue, vq->num_free >= 3);
+		wait_event(vgdev->ctrlq.ack_queue,
+			   vq->num_free >= 2 + outcnt);
 		goto again;
 	}
 
-- 
2.25.0.341.g760bfbb309-goog



More information about the dri-devel mailing list