net/virtio-user: fix tapfds close
authorWenfeng Liu <liuwf@arraynetworks.com.cn>
Mon, 13 Mar 2017 09:33:21 +0000 (09:33 +0000)
committerYuanhan Liu <yuanhan.liu@linux.intel.com>
Sat, 1 Apr 2017 06:58:54 +0000 (08:58 +0200)
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 <liuwf@arraynetworks.com.cn>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
drivers/net/virtio/virtio_user/vhost_kernel.c

index 05aa6c6..68d28b1 100644 (file)
@@ -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;
                }