Skip to content

Commit

Permalink
vhost: fix virtqueue initialization
Browse files Browse the repository at this point in the history
[ upstream commit 7804bbd ]

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: 8acd7c2 ("vhost: fix virtqueues metadata allocation")

Reported-by: Yu Jiang <yux.jiang@intel.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Tested-by: Yu Jiang <yux.jiang@intel.com>
  • Loading branch information
mcoquelin authored and bluca committed Nov 16, 2020
1 parent 61814ea commit 18b6f15
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/librte_vhost/vhost.c
Expand Up @@ -575,7 +575,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;
Expand Down

0 comments on commit 18b6f15

Please sign in to comment.