From: Maxime Coquelin Date: Fri, 6 Nov 2020 14:47:44 +0000 (+0100) Subject: vhost: fix virtqueue initialization X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7804bbd13aa583e3a28b08557f7a98fcbe7fc8a8;p=dpdk.git vhost: fix virtqueue initialization This patches fixes virtqueue initialization issue causing segfault or file descriptor being closed unexpectedly. The wrong index was passed to init_vring_queue() by alloc_vring_queue() when a hole in the virtqueue array was met. Fixes: 8acd7c213353 ("vhost: fix virtqueues metadata allocation") Cc: stable@dpdk.org Reported-by: Yu Jiang Signed-off-by: Maxime Coquelin Reviewed-by: David Marchand Tested-by: Yu Jiang --- diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index 8a151a9c1d..b83cf639eb 100644 --- a/lib/librte_vhost/vhost.c +++ b/lib/librte_vhost/vhost.c @@ -605,7 +605,7 @@ alloc_vring_queue(struct virtio_net *dev, uint32_t vring_idx) } dev->virtqueue[i] = vq; - init_vring_queue(dev, vring_idx); + init_vring_queue(dev, i); rte_spinlock_init(&vq->access_lock); vq->avail_wrap_counter = 1; vq->used_wrap_counter = 1;