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

luca.boccassi at gmail.com luca.boccassi at gmail.com
Thu Nov 3 10:27:01 CET 2022


Hi,

FYI, your patch has been queued to stable release 20.11.7

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/05/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/75888970cd5de90d9faec4fa978a8f3d36f18d8b

Thanks.

Luca Boccassi

---
>From 75888970cd5de90d9faec4fa978a8f3d36f18d8b 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 8567e43471..c7272b457b 100644
--- a/drivers/net/mlx5/linux/mlx5_mp_os.c
+++ b/drivers/net/mlx5/linux/mlx5_mp_os.c
@@ -138,14 +138,18 @@ struct rte_mp_msg mp_res;
 			mlx5_tx_uar_uninit_secondary(dev);
 			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);
 		res->result = 0;
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 8bd717e6a9..af19b54b7e 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -813,6 +813,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	DRV_LOG(DEBUG, "naming Ethernet device \"%s\"", name);
 	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
 		struct mlx5_mp_id mp_id;
+		int fd;
 
 		eth_dev = rte_eth_dev_attach_secondary(name);
 		if (eth_dev == NULL) {
@@ -836,11 +837,12 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		mp_id.port_id = eth_dev->data->port_id;
 		strlcpy(mp_id.name, MLX5_MP_NAME, RTE_MP_MAX_NAME_LEN);
 		/* 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.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-11-03 09:27:28.035569258 +0000
+++ 0043-net-mlx5-fix-Verbs-FD-leak-in-secondary-process.patch	2022-11-03 09:27:25.417423292 +0000
@@ -1 +1 @@
-From bc5d8fdb7008210e2698fa1f91e51d7dfba00f77 Mon Sep 17 00:00:00 2001
+From 75888970cd5de90d9faec4fa978a8f3d36f18d8b 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 8567e43471..c7272b457b 100644
@@ -23 +24 @@
-@@ -177,14 +177,18 @@ struct rte_mp_msg mp_res;
+@@ -138,14 +138,18 @@ struct rte_mp_msg mp_res;
@@ -44 +45 @@
-index 4f0a6f4d55..6e5f01dda0 100644
+index 8bd717e6a9..af19b54b7e 100644
@@ -47 +48 @@
-@@ -1080,6 +1080,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
+@@ -813,6 +813,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
@@ -55,3 +56,3 @@
-@@ -1096,11 +1097,12 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
- 			return NULL;
- 		mlx5_mp_id_init(&mp_id, eth_dev->data->port_id);
+@@ -836,11 +837,12 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
+ 		mp_id.port_id = eth_dev->data->port_id;
+ 		strlcpy(mp_id.name, MLX5_MP_NAME, RTE_MP_MAX_NAME_LEN);


More information about the stable mailing list