Calling vring_invalidate must be done with a (write) lock taken on the
virtqueue.

Fixes: 72d002b3ebda ("vhost: fix vring address handling during live migration")
Cc: sta...@dpdk.org

Signed-off-by: David Marchand <david.march...@redhat.com>
Acked-by: Eelco Chaudron <echau...@redhat.com>
---
Changes since v1:
- moved fix out of patch 3,

---
 lib/vhost/vhost_user.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index e36312181a..a323ce5fbf 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -2198,7 +2198,9 @@ vhost_user_get_vring_base(struct virtio_net **pdev,
 
        vhost_user_iotlb_flush_all(dev);
 
+       rte_rwlock_write_lock(&vq->access_lock);
        vring_invalidate(dev, vq);
+       rte_rwlock_write_unlock(&vq->access_lock);
 
        return RTE_VHOST_MSG_RESULT_REPLY;
 }
-- 
2.42.0

Reply via email to