DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yunjian Wang <wangyunjian@huawei.com>
To: <dev@dpdk.org>
Cc: <matan@nvidia.com>, <suanmingm@nvidia.com>,
	<jerry.lilijun@huawei.com>, Yunjian Wang <wangyunjian@huawei.com>,
	<stable@dpdk.org>
Subject: [PATCH 1/1] net/mlx5: fix memoy leak after device spawn failure
Date: Thu, 18 Dec 2025 17:31:20 +0800	[thread overview]
Message-ID: <1766050280-21036-1-git-send-email-wangyunjian@huawei.com> (raw)

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


             reply	other threads:[~2025-12-18  9:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-18  9:31 Yunjian Wang [this message]
2025-12-18 10:57 ` [PATCH v2] " Yunjian Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1766050280-21036-1-git-send-email-wangyunjian@huawei.com \
    --to=wangyunjian@huawei.com \
    --cc=dev@dpdk.org \
    --cc=jerry.lilijun@huawei.com \
    --cc=matan@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=suanmingm@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).