diff options
author | 2016-09-19 18:47:39 +0300 | |
---|---|---|
committer | 2016-09-20 17:29:19 +0000 | |
commit | f298ecfe1d408164dd2be5205824da9a6b218279 (patch) | |
tree | 52a2d1c7e465736fa62fed4e32a3119eadff80a4 | |
parent | d334a6b458e2ea60ee82b402d4785f5a2abc3c24 (diff) |
fd closed twice
fd close()ed after call to unix_file_del of same fd
Change-Id: Ia8bf77b72b6cea7c70e004199ce11a33b6260720
Signed-off-by: Eyal Bari <ebari@cisco.com>
-rw-r--r-- | vnet/vnet/devices/af_packet/af_packet.c | 4 | ||||
-rw-r--r-- | vnet/vnet/devices/netmap/netmap.c | 3 | ||||
-rw-r--r-- | vnet/vnet/devices/virtio/vhost-user.c | 3 | ||||
-rw-r--r-- | vnet/vnet/unix/tapcli.c | 3 |
4 files changed, 8 insertions, 5 deletions
diff --git a/vnet/vnet/devices/af_packet/af_packet.c b/vnet/vnet/devices/af_packet/af_packet.c index 17eddd65..cec25fed 100644 --- a/vnet/vnet/devices/af_packet/af_packet.c +++ b/vnet/vnet/devices/af_packet/af_packet.c @@ -308,6 +308,9 @@ af_packet_delete_if (vlib_main_t * vm, u8 * host_if_name) unix_file_del (&unix_main, unix_main.file_pool + apif->unix_file_index); apif->unix_file_index = ~0; } + else + close (apif->fd); + ring_sz = apif->rx_req->tp_block_size * apif->rx_req->tp_block_nr + apif->tx_req->tp_block_size * apif->tx_req->tp_block_nr; if (munmap (apif->rx_ring, ring_sz)) @@ -315,7 +318,6 @@ af_packet_delete_if (vlib_main_t * vm, u8 * host_if_name) host_if_name); apif->rx_ring = NULL; apif->tx_ring = NULL; - close (apif->fd); apif->fd = -1; vec_free (apif->rx_req); diff --git a/vnet/vnet/devices/netmap/netmap.c b/vnet/vnet/devices/netmap/netmap.c index fe6f1eaf..3bdb442d 100644 --- a/vnet/vnet/devices/netmap/netmap.c +++ b/vnet/vnet/devices/netmap/netmap.c @@ -59,8 +59,7 @@ close_netmap_if (netmap_main_t * nm, netmap_if_t * nif) unix_file_del (&unix_main, unix_main.file_pool + nif->unix_file_index); nif->unix_file_index = ~0; } - - if (nif->fd > -1) + else if (nif->fd > -1) close (nif->fd); if (nif->mem_region) diff --git a/vnet/vnet/devices/virtio/vhost-user.c b/vnet/vnet/devices/virtio/vhost-user.c index 76c682f5..2ca5aa89 100644 --- a/vnet/vnet/devices/virtio/vhost-user.c +++ b/vnet/vnet/devices/virtio/vhost-user.c @@ -252,10 +252,11 @@ vhost_user_if_disconnect (vhost_user_intf_t * vui) unix_file_del (&unix_main, unix_main.file_pool + vui->unix_file_index); vui->unix_file_index = ~0; } + else + close (vui->unix_fd); hash_unset (vum->vhost_user_interface_index_by_sock_fd, vui->unix_fd); hash_unset (vum->vhost_user_interface_index_by_listener_fd, vui->unix_fd); - close (vui->unix_fd); vui->unix_fd = -1; vui->is_up = 0; for (q = 0; q < vui->num_vrings; q++) diff --git a/vnet/vnet/unix/tapcli.c b/vnet/vnet/unix/tapcli.c index c2328f0d..0be68a9e 100644 --- a/vnet/vnet/unix/tapcli.c +++ b/vnet/vnet/unix/tapcli.c @@ -1025,10 +1025,11 @@ static int tapcli_tap_disconnect (tapcli_interface_t *ti) unix_file_del (&unix_main, unix_main.file_pool + ti->unix_file_index); ti->unix_file_index = ~0; } + else + close(ti->unix_fd); hash_unset (tm->tapcli_interface_index_by_unix_fd, ti->unix_fd); hash_unset (tm->tapcli_interface_index_by_sw_if_index, ti->sw_if_index); - close(ti->unix_fd); close(ti->provision_fd); ti->unix_fd = -1; ti->provision_fd = -1; |