net/mlx5: fix verbs fd leak in the secondary process

Message ID 1657128145-7764-2-git-send-email-longli@linuxonhyperv.com (mailing list archive)
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: fix verbs fd leak in the secondary process |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-abi-testing success Testing PASS
ci/intel-Testing success Testing PASS

Commit Message

Long Li July 6, 2022, 5:22 p.m. UTC
  From: Long Li <longli@microsoft.com>

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@microsoft.com>
---
 drivers/net/mlx5/mlx5_txq.c | 2 ++
 1 file changed, 2 insertions(+)
  

Patch

diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index 4e0bf7af9c..df55a4cd25 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -636,6 +636,7 @@  mlx5_tx_uar_init_secondary(struct rte_eth_dev *dev, int fd)
 		if (ret)
 			goto error;
 	}
+	close(fd);
 	return 0;
 error:
 	/* Rollback. */
@@ -646,6 +647,7 @@  mlx5_tx_uar_init_secondary(struct rte_eth_dev *dev, int fd)
 		txq_ctrl = container_of(txq, struct mlx5_txq_ctrl, txq);
 		txq_uar_uninit_secondary(txq_ctrl);
 	} while (i--);
+	close(fd);
 	return -rte_errno;
 }