vhost: fix virtqueue use after free on NUMA reallocation

translate_ring_addresses (via numa_realloc) may change a virtio device and
virtio queue.
The virtqueue object must be refreshed before accessing the lock.

Fixes: 04c27cb673 ("vhost: fix unsafe vring addresses modifications")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
This commit is contained in:
David Marchand 2022-07-25 22:32:03 +02:00 committed by Thomas Monjalon
parent d5b39b6fe9
commit 0b2a2ca350

View File

@ -2596,6 +2596,7 @@ vhost_user_iotlb_msg(struct virtio_net **pdev,
if (is_vring_iotlb(dev, vq, imsg)) {
rte_spinlock_lock(&vq->access_lock);
*pdev = dev = translate_ring_addresses(dev, i);
vq = dev->virtqueue[i];
rte_spinlock_unlock(&vq->access_lock);
}
}