From: Yunjian Wang <wangyunj...@huawei.com>

Zero is a valid fd. The fd won't be closed thus leading fd leak,
when it is zero.

Fixes: f234e5bd996d ("net/failsafe: register slaves Rx interrupts")
Fixes: 9e0360aebf23 ("net/failsafe: register as Rx interrupt mode")
Cc: sta...@dpdk.org

Signed-off-by: Yunjian Wang <wangyunj...@huawei.com>
---
 drivers/net/failsafe/failsafe_intr.c | 2 +-
 drivers/net/failsafe/failsafe_ops.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/failsafe/failsafe_intr.c 
b/drivers/net/failsafe/failsafe_intr.c
index d8728fe7e..602c04033 100644
--- a/drivers/net/failsafe/failsafe_intr.c
+++ b/drivers/net/failsafe/failsafe_intr.c
@@ -393,7 +393,7 @@ fs_rx_event_proxy_uninstall(struct fs_priv *priv)
                free(priv->rxp.evec);
                priv->rxp.evec = NULL;
        }
-       if (priv->rxp.efd > 0) {
+       if (priv->rxp.efd >= 0) {
                close(priv->rxp.efd);
                priv->rxp.efd = -1;
        }
diff --git a/drivers/net/failsafe/failsafe_ops.c 
b/drivers/net/failsafe/failsafe_ops.c
index 50f2aca4e..e1d08e46c 100644
--- a/drivers/net/failsafe/failsafe_ops.c
+++ b/drivers/net/failsafe/failsafe_ops.c
@@ -380,7 +380,7 @@ fs_rx_queue_release(void *queue)
        rxq = queue;
        dev = &rte_eth_devices[rxq->priv->data->port_id];
        fs_lock(dev, 0);
-       if (rxq->event_fd > 0)
+       if (rxq->event_fd >= 0)
                close(rxq->event_fd);
        FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
                if (ETH(sdev)->data->rx_queues != NULL &&
-- 
2.19.1


Reply via email to