From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tetsuya Mukawa Subject: [PATCH v2] vhost: Fix wrong handling of virtqueue array index Date: Wed, 28 Oct 2015 11:59:39 +0900 Message-ID: <1446001179-27443-1-git-send-email-mukawa@igel.co.jp> Cc: ann.zhuangyanying@huawei.com To: dev@dpdk.org Return-path: Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by dpdk.org (Postfix) with ESMTP id 582FF5A65 for ; Wed, 28 Oct 2015 03:59:57 +0100 (CET) Received: by pasz6 with SMTP id z6so241288279pas.2 for ; Tue, 27 Oct 2015 19:59:56 -0700 (PDT) List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The patch fixes wrong handling of virtqueue array index when GET_VRING_BASE message comes. --- 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 a998ad8..d07452a 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.1.4