From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 792F5A00BE; Mon, 27 Apr 2020 12:44:34 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DB1481D14B; Mon, 27 Apr 2020 12:44:33 +0200 (CEST) Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) by dpdk.org (Postfix) with ESMTP id 3CAE21C440; Mon, 27 Apr 2020 12:44:31 +0200 (CEST) Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id F2A5632515E4B90FECCC; Mon, 27 Apr 2020 18:44:27 +0800 (CST) Received: from localhost (10.173.251.152) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.487.0; Mon, 27 Apr 2020 18:44:19 +0800 From: wangyunjian To: , CC: , , Yunjian Wang , Date: Mon, 27 Apr 2020 18:44:19 +0800 Message-ID: <1587984259-18296-1-git-send-email-wangyunjian@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.173.251.152] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH] net/failsafe: fix fd leak X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Yunjian Wang 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: stable@dpdk.org Signed-off-by: Yunjian Wang --- 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