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") Signed-off-by: Wenfeng Liu <li...@arraynetworks.com.cn> --- drivers/net/virtio/virtio_user/vhost_kernel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c b/drivers/net/virtio/virtio_user/vhost_kernel.c index 05aa6c6..68d28b1 100644 --- a/drivers/net/virtio/virtio_user/vhost_kernel.c +++ b/drivers/net/virtio/virtio_user/vhost_kernel.c @@ -365,7 +365,7 @@ struct vhost_memory_kernel { 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; } -- 1.8.3.1