DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/1] net/mlx5: fix memoy leak after device spawn failure
@ 2025-12-18  9:31 Yunjian Wang
  2025-12-18 10:57 ` [PATCH v2] " Yunjian Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Yunjian Wang @ 2025-12-18  9:31 UTC (permalink / raw)
  To: dev; +Cc: matan, suanmingm, jerry.lilijun, Yunjian Wang, stable

In mlx5_dev_spawn() allocated memory for the 'priv->flows',
we should free it when errors occur, otherwise it will lead
to memory leak.

Fixes: b4edeaf3efd5 ("net/mlx5: replace flow list with indexed pool")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/net/mlx5/linux/mlx5_os.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 7f73183bb1..10b59e779a 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -1831,6 +1831,11 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 			close(priv->nl_socket_route);
 		if (priv->vmwa_context)
 			mlx5_vlan_vmwa_exit(priv->vmwa_context);
+                for (i = 0; i < MLX5_FLOW_TYPE_MAXI; i++) {
+                        if (!priv->flows[i])
+                                continue;
+                        mlx5_ipool_destroy(priv->flows[i]);
+                }
 		if (eth_dev && priv->drop_queue.hrxq)
 			mlx5_drop_action_destroy(eth_dev);
 		if (priv->mtr_profile_tbl)
-- 
2.33.0


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

* [PATCH v2] net/mlx5: fix memoy leak after device spawn failure
  2025-12-18  9:31 [PATCH 1/1] net/mlx5: fix memoy leak after device spawn failure Yunjian Wang
@ 2025-12-18 10:57 ` Yunjian Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Yunjian Wang @ 2025-12-18 10:57 UTC (permalink / raw)
  To: dev; +Cc: matan, suanmingm, jerry.lilijun, Yunjian Wang, stable

In mlx5_dev_spawn() allocated memory for the 'priv->flows',
we should free it when errors occur, otherwise it will lead
to memory leak.

Fixes: b4edeaf3efd5 ("net/mlx5: replace flow list with indexed pool")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
v2: fix code styles
---
 drivers/net/mlx5/linux/mlx5_os.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 7f73183bb1..7624b2aba2 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -1831,6 +1831,11 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 			close(priv->nl_socket_route);
 		if (priv->vmwa_context)
 			mlx5_vlan_vmwa_exit(priv->vmwa_context);
+		for (i = 0; i < MLX5_FLOW_TYPE_MAXI; i++) {
+			if (!priv->flows[i])
+				continue;
+			mlx5_ipool_destroy(priv->flows[i]);
+		}
 		if (eth_dev && priv->drop_queue.hrxq)
 			mlx5_drop_action_destroy(eth_dev);
 		if (priv->mtr_profile_tbl)
-- 
2.33.0


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

end of thread, other threads:[~2025-12-18 10:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-18  9:31 [PATCH 1/1] net/mlx5: fix memoy leak after device spawn failure Yunjian Wang
2025-12-18 10:57 ` [PATCH v2] " Yunjian Wang

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).