Skip to content

Commit

Permalink
vhost: fix missing virtqueue lock protection
Browse files Browse the repository at this point in the history
[ upstream commit c573699 ]

This patch ensures virtqueue metadata are not being
modified while rte_vhost_vring_call() is executed.

Fixes: 6c299bb ("vhost: introduce vring call API")

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
  • Loading branch information
mcoquelin authored and kevintraynor committed May 24, 2022
1 parent e3036fb commit 78414da
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/vhost/vhost.c
Expand Up @@ -1299,11 +1299,15 @@ rte_vhost_vring_call(int vid, uint16_t vring_idx)
if (!vq)
return -1;

rte_spinlock_lock(&vq->access_lock);

if (vq_is_packed(dev))
vhost_vring_call_packed(dev, vq);
else
vhost_vring_call_split(dev, vq);

rte_spinlock_unlock(&vq->access_lock);

return 0;
}

Expand Down

0 comments on commit 78414da

Please sign in to comment.