DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev]  [PATCH] net/failsafe: fix fd leak
@ 2020-04-27 10:44 wangyunjian
  2020-04-27 11:12 ` Gaëtan Rivet
  0 siblings, 1 reply; 23+ messages in thread
From: wangyunjian @ 2020-04-27 10:44 UTC (permalink / raw)
  To: dev, grive; +Cc: jerry.lilijun, xudingke, Yunjian Wang, stable

From: Yunjian Wang <wangyunjian@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: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@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



^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2020-05-11 16:54 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-27 10:44 [dpdk-dev] [PATCH] net/failsafe: fix fd leak wangyunjian
2020-04-27 11:12 ` Gaëtan Rivet
2020-04-27 16:55   ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2020-05-03 11:33     ` Ali Alnubani
2020-05-04 16:22       ` Gaëtan Rivet
2020-05-04 16:28         ` Stephen Hemminger
2020-05-05  9:47           ` Ali Alnubani
2020-05-05  9:14         ` Ali Alnubani
2020-05-05 18:35           ` Gaëtan Rivet
2020-05-05 19:10       ` [dpdk-dev] [PATCH v1 0/3] failsafe & ring fixes Gaetan Rivet
2020-05-05 19:10         ` [dpdk-dev] [PATCH v1 1/3] net/failsafe: avoid crash on malformed eth_dev Gaetan Rivet
2020-05-06 17:16           ` Ferruh Yigit
2020-05-05 19:10         ` [dpdk-dev] [PATCH v1 2/3] net/ring: fix eth_dev device pointer on allocation Gaetan Rivet
2020-05-06 11:48           ` Ferruh Yigit
2020-05-06 12:33             ` Gaëtan Rivet
2020-05-06 13:43               ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2020-05-06 17:32                 ` Gaëtan Rivet
2020-05-06 18:09                   ` [dpdk-dev] [PATCH v2] " Gaetan Rivet
2020-05-08 11:00                     ` Ferruh Yigit
2020-05-11 16:54                       ` Ferruh Yigit
2020-05-05 19:10         ` [dpdk-dev] [PATCH v1 3/3] net/failsafe: fix default service proxy state Gaetan Rivet
2020-05-06  8:58           ` Ali Alnubani
2020-05-06 17:16           ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).