virtio/vdrm: Fix lockup in vdrm_host_sync()

The vdrm_execbuf() missed to set the seqno field for requests sent to host.
This causes vdrm_host_sync() to lock up due to the unset seqno in a case
where two or more threads are using vdrm_execbuf() and vdrm_send_req()
concurrently, like in this scenario:

	thread1: vdrm_send_req()  shmem->seqno=1 req->seqno=2
	thread2: vdrm_execbuf()   shmem->seqno=1 req->seqno=0
	thread1: vdrm_host_sync() shmem->seqno=0 req->seqno=2

Fix the lockup by setting the seqno in vdrm_execbuf().

Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27021>
This commit is contained in:
Dmitry Osipenko 2024-01-11 22:15:46 +03:00 committed by Marge Bot
parent 2fa1979c66
commit b9ad22d24e

View file

@ -109,6 +109,8 @@ vdrm_execbuf(struct vdrm_device *vdev, struct vdrm_execbuf_params *p)
simple_mtx_lock(&vdev->eb_lock);
p->req->seqno = ++vdev->next_seqno;
ret = vdev->funcs->flush_locked(vdev, NULL);
if (ret)
goto out_unlock;