Skip to content

Commit

Permalink
vhost: fix missing virtqueue lock protection
Browse files Browse the repository at this point in the history
This patch ensures virtqueue metadata are not being
modified while rte_vhost_vring_call() is executed.

Fixes: 6c299bb ("vhost: introduce vring call API")
Cc: stable@dpdk.org

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
  • Loading branch information
mcoquelin committed May 9, 2022
1 parent 09c2856 commit c573699
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/vhost/vhost.c
Original file line number Diff line number Diff line change
Expand Up @@ -1291,11 +1291,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 c573699

Please sign in to comment.