[dpdk-stable] patch 'net/failsafe: fix fd leak' has been queued to LTS release 18.11.9

Kevin Traynor ktraynor at redhat.com
Fri Jun 5 20:24:29 CEST 2020


Hi,

FYI, your patch has been queued to LTS release 18.11.9

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/10/20. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable-queue/commit/6268dc292c836f2b1b1576e35eef8ecf7edd9a80

Thanks.

Kevin.

---
>From 6268dc292c836f2b1b1576e35eef8ecf7edd9a80 Mon Sep 17 00:00:00 2001
From: Yunjian Wang <wangyunjian at huawei.com>
Date: Mon, 27 Apr 2020 18:44:19 +0800
Subject: [PATCH] net/failsafe: fix fd leak

[ upstream commit b9663f60359296bcb6f0be8a3d6a2a838c77ee30 ]

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

Also the service proxy is initialized at 0. This is assuming that all of
its fields are invalid at 0. The issue is that a file descriptor at 0 is
a valid one.

The value -1 is used as sentinel during cleanup. Initialize the RX proxy
file descriptor to -1.

Fixes: f234e5bd996d ("net/failsafe: register slaves Rx interrupts")
Fixes: 9e0360aebf23 ("net/failsafe: register as Rx interrupt mode")

Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
Signed-off-by: Gaetan Rivet <grive at u256.net>
Tested-by: Ali Alnubani <alialnu at mellanox.com>
---
 drivers/net/failsafe/failsafe.c         | 1 +
 drivers/net/failsafe/failsafe_intr.c    | 2 +-
 drivers/net/failsafe/failsafe_ops.c     | 2 +-
 drivers/net/failsafe/failsafe_private.h | 8 ++++++++
 4 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 06e859e9fd..0180954123 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -183,4 +183,5 @@ fs_eth_dev_create(struct rte_vdev_device *vdev)
 	priv = PRIV(dev);
 	priv->dev = dev;
+	priv->rxp = FS_RX_PROXY_INIT;
 	dev->dev_ops = &failsafe_ops;
 	dev->data->mac_addrs = &PRIV(dev)->mac_addrs[0];
diff --git a/drivers/net/failsafe/failsafe_intr.c b/drivers/net/failsafe/failsafe_intr.c
index 1c2cb71c41..de229b2c2f 100644
--- a/drivers/net/failsafe/failsafe_intr.c
+++ b/drivers/net/failsafe/failsafe_intr.c
@@ -395,5 +395,5 @@ fs_rx_event_proxy_uninstall(struct fs_priv *priv)
 		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 595278bbf7..a3c30c25a9 100644
--- a/drivers/net/failsafe/failsafe_ops.c
+++ b/drivers/net/failsafe/failsafe_ops.c
@@ -380,5 +380,5 @@ fs_rx_queue_release(void *queue)
 	dev = rxq->priv->dev;
 	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) {
diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h
index 3264bff2f8..cfe29c3f33 100644
--- a/drivers/net/failsafe/failsafe_private.h
+++ b/drivers/net/failsafe/failsafe_private.h
@@ -59,4 +59,12 @@ struct rx_proxy {
 };
 
+#define FS_RX_PROXY_INIT (struct rx_proxy){ \
+	.efd = -1, \
+	.evec = NULL, \
+	.sid = 0, \
+	.scid = 0, \
+	.sstate = SS_NO_SERVICE, \
+}
+
 struct rxq {
 	struct fs_priv *priv;
-- 
2.21.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-06-05 19:20:52.615257891 +0100
+++ 0032-net-failsafe-fix-fd-leak.patch	2020-06-05 19:20:50.761041926 +0100
@@ -1 +1 @@
-From b9663f60359296bcb6f0be8a3d6a2a838c77ee30 Mon Sep 17 00:00:00 2001
+From 6268dc292c836f2b1b1576e35eef8ecf7edd9a80 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit b9663f60359296bcb6f0be8a3d6a2a838c77ee30 ]
+
@@ -18 +19,0 @@
-Cc: stable at dpdk.org
@@ -31 +32 @@
-index 8af31d71b3..72362f35de 100644
+index 06e859e9fd..0180954123 100644
@@ -34 +35 @@
-@@ -191,4 +191,5 @@ fs_eth_dev_create(struct rte_vdev_device *vdev)
+@@ -183,4 +183,5 @@ fs_eth_dev_create(struct rte_vdev_device *vdev)
@@ -36 +37 @@
- 	priv->data = dev->data;
+ 	priv->dev = dev;
@@ -41 +42 @@
-index d8728fe7e3..602c04033c 100644
+index 1c2cb71c41..de229b2c2f 100644
@@ -44 +45 @@
-@@ -394,5 +394,5 @@ fs_rx_event_proxy_uninstall(struct fs_priv *priv)
+@@ -395,5 +395,5 @@ fs_rx_event_proxy_uninstall(struct fs_priv *priv)
@@ -52 +53 @@
-index 50f2aca4e7..e1d08e46c8 100644
+index 595278bbf7..a3c30c25a9 100644
@@ -55,2 +56,2 @@
-@@ -381,5 +381,5 @@ fs_rx_queue_release(void *queue)
- 	dev = &rte_eth_devices[rxq->priv->data->port_id];
+@@ -380,5 +380,5 @@ fs_rx_queue_release(void *queue)
+ 	dev = rxq->priv->dev;
@@ -63 +64 @@
-index 8e9706aef0..651578a128 100644
+index 3264bff2f8..cfe29c3f33 100644



More information about the stable mailing list