From: Wenfeng Liu Date: Mon, 13 Mar 2017 09:33:21 +0000 (+0000) Subject: net/virtio-user: fix tapfds close X-Git-Tag: spdx-start~3921 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=250c99651a774d6e2d02ee90aa33a07a1ea6fc0b;p=dpdk.git net/virtio-user: fix tapfds close The valid tap file descriptor range should be equal or greater than zero instead of non-zero Fixes: e3b434818bbb ("net/virtio-user: support kernel vhost") Cc: stable@dpdk.org Signed-off-by: Wenfeng Liu Acked-by: Yuanhan Liu --- diff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c b/drivers/net/virtio/virtio_user/vhost_kernel.c index 05aa6c6d5c..68d28b1304 100644 --- a/drivers/net/virtio/virtio_user/vhost_kernel.c +++ b/drivers/net/virtio/virtio_user/vhost_kernel.c @@ -365,7 +365,7 @@ vhost_kernel_enable_queue_pair(struct virtio_user_dev *dev, vhostfd = dev->vhostfds[pair_idx]; if (!enable) { - if (dev->tapfds[pair_idx]) { + if (dev->tapfds[pair_idx] >= 0) { close(dev->tapfds[pair_idx]); dev->tapfds[pair_idx] = -1; }