[dpdk-dev] net/virtio-user: fix tapfds close issue

Message ID 1489397601-2986-1-git-send-email-liuwf@arraynetworks.com.cn (mailing list archive)
State Accepted, archived
Delegated to: Yuanhan Liu
Headers

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Wenfeng Liu March 13, 2017, 9:33 a.m. UTC
  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 <liuwf@arraynetworks.com.cn>
---
 drivers/net/virtio/virtio_user/vhost_kernel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Yuanhan Liu March 14, 2017, 6:22 a.m. UTC | #1
On Mon, Mar 13, 2017 at 09:33:21AM +0000, Wenfeng Liu wrote:
> 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

Applied to dpdk-next-virtio. Thanks.

	--yliu

> Signed-off-by: Wenfeng Liu <liuwf@arraynetworks.com.cn>
> ---
  

Patch

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;
 		}