patch 'net/mlx5: fix Verbs FD leak in secondary process' has been queued to stable release 21.11.3

Kevin Traynor ktraynor at redhat.com
Tue Oct 25 17:07:00 CEST 2022


Hi,

FYI, your patch has been queued to stable release 21.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/01/22. 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

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/879ebb7dcee5d4e8bc19c5e985cd005579ee604a

Thanks.

Kevin

---
>From 879ebb7dcee5d4e8bc19c5e985cd005579ee604a Mon Sep 17 00:00:00 2001
From: Long Li <longli at microsoft.com>
Date: Wed, 6 Jul 2022 10:48:53 -0700
Subject: [PATCH] net/mlx5: fix Verbs FD leak in secondary process

[ upstream commit bc5d8fdb7008210e2698fa1f91e51d7dfba00f77 ]

FDs passed from rte_mp_msg are duplicated to the secondary process and
need to be closed.

Fixes: 9a8ab29b84 ("net/mlx5: replace IPC socket with EAL API")

Signed-off-by: Long Li <longli at microsoft.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo at nvidia.com>
---
 drivers/net/mlx5/linux/mlx5_mp_os.c | 6 +++++-
 drivers/net/mlx5/linux/mlx5_os.c    | 8 +++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mlx5/linux/mlx5_mp_os.c b/drivers/net/mlx5/linux/mlx5_mp_os.c
index c448a3e9eb..0ba2208fe0 100644
--- a/drivers/net/mlx5/linux/mlx5_mp_os.c
+++ b/drivers/net/mlx5/linux/mlx5_mp_os.c
@@ -178,12 +178,16 @@ struct rte_mp_msg mp_res;
 			mlx5_proc_priv_uninit(dev);
 			ret = mlx5_proc_priv_init(dev);
-			if (ret)
+			if (ret) {
+				close(mp_msg->fds[0]);
 				return -rte_errno;
+			}
 			ret = mlx5_tx_uar_init_secondary(dev, mp_msg->fds[0]);
 			if (ret) {
+				close(mp_msg->fds[0]);
 				mlx5_proc_priv_uninit(dev);
 				return -rte_errno;
 			}
 		}
+		close(mp_msg->fds[0]);
 		rte_mb();
 		mp_init_msg(&priv->mp_id, &mp_res, param->type);
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 792dd2cb22..27d6fe644d 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -934,4 +934,5 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
 		struct mlx5_mp_id mp_id;
+		int fd;
 
 		eth_dev = rte_eth_dev_attach_secondary(name);
@@ -950,9 +951,10 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		mlx5_mp_id_init(&mp_id, eth_dev->data->port_id);
 		/* Receive command fd from primary process */
-		err = mlx5_mp_req_verbs_cmd_fd(&mp_id);
-		if (err < 0)
+		fd = mlx5_mp_req_verbs_cmd_fd(&mp_id);
+		if (fd < 0)
 			goto err_secondary;
 		/* Remap UAR for Tx queues. */
-		err = mlx5_tx_uar_init_secondary(eth_dev, err);
+		err = mlx5_tx_uar_init_secondary(eth_dev, fd);
+		close(fd);
 		if (err)
 			goto err_secondary;
-- 
2.37.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-10-25 14:19:00.017118199 +0100
+++ 0065-net-mlx5-fix-Verbs-FD-leak-in-secondary-process.patch	2022-10-25 14:18:58.471798306 +0100
@@ -1 +1 @@
-From bc5d8fdb7008210e2698fa1f91e51d7dfba00f77 Mon Sep 17 00:00:00 2001
+From 879ebb7dcee5d4e8bc19c5e985cd005579ee604a Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit bc5d8fdb7008210e2698fa1f91e51d7dfba00f77 ]
+
@@ -10 +11,0 @@
-Cc: stable at dpdk.org
@@ -20 +21 @@
-index e607089e0e..f2e71c9bd4 100644
+index c448a3e9eb..0ba2208fe0 100644
@@ -42 +43 @@
-index 4f0a6f4d55..6e5f01dda0 100644
+index 792dd2cb22..27d6fe644d 100644
@@ -45 +46 @@
-@@ -1081,4 +1081,5 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
+@@ -934,4 +934,5 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
@@ -51 +52 @@
-@@ -1097,9 +1098,10 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
+@@ -950,9 +951,10 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,



More information about the stable mailing list