From 07d37fbf5e91e72f961900d851611afe47702548 Mon Sep 17 00:00:00 2001 From: Tetsuya Mukawa Date: Wed, 28 Oct 2015 12:47:40 +0900 Subject: [PATCH] vhost: fix crash with multiqueue enabled The patch fixes wrong handling of virtqueue array index when GET_VRING_BASE message comes. Signed-off-by: Tetsuya Mukawa Acked-by: Huawei Xie Acked-by: Flavio Leitner --- lib/librte_vhost/vhost_user/virtio-net-user.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c b/lib/librte_vhost/vhost_user/virtio-net-user.c index a998ad8112..d07452a6f8 100644 --- a/lib/librte_vhost/vhost_user/virtio-net-user.c +++ b/lib/librte_vhost/vhost_user/virtio-net-user.c @@ -300,13 +300,9 @@ user_get_vring_base(struct vhost_device_ctx ctx, * sent and only sent in vhost_vring_stop. * TODO: cleanup the vring, it isn't usable since here. */ - if (dev->virtqueue[state->index + VIRTIO_RXQ]->kickfd >= 0) { - close(dev->virtqueue[state->index + VIRTIO_RXQ]->kickfd); - dev->virtqueue[state->index + VIRTIO_RXQ]->kickfd = -1; - } - if (dev->virtqueue[state->index + VIRTIO_TXQ]->kickfd >= 0) { - close(dev->virtqueue[state->index + VIRTIO_TXQ]->kickfd); - dev->virtqueue[state->index + VIRTIO_TXQ]->kickfd = -1; + if (dev->virtqueue[state->index]->kickfd >= 0) { + close(dev->virtqueue[state->index]->kickfd); + dev->virtqueue[state->index]->kickfd = -1; } return 0; -- 2.20.1