DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maayan Kashani <mkashani@nvidia.com>
To: <dev@dpdk.org>
Cc: <mkashani@nvidia.com>, <rasland@nvidia.com>, <stable@dpdk.org>,
	"Dariusz Sosnowski" <dsosnowski@nvidia.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
	Bing Zhao <bingz@nvidia.com>, Ori Kam <orika@nvidia.com>,
	Suanming Mou <suanmingm@nvidia.com>,
	Matan Azrad <matan@nvidia.com>,
	Gregory Etelson <getelson@nvidia.com>
Subject: [PATCH] net/mlx5: fix HWS sample action table leak on quit
Date: Sun, 16 Aug 2026 11:15:24 +0300	[thread overview]
Message-ID: <20260816081525.166446-1-mkashani@nvidia.com> (raw)

Destroy the composite dest_array mirror action before releasing its
clone destinations. Releasing a JUMP clone can drop the last group
table reference while the dest_array still points at that table,
leaving the firmware flow table objects leaked on port close.

Fixes: 3564e928c759 ("net/mlx5: support HWS flow mirror action")
Cc: stable@dpdk.org

Signed-off-by: Maayan Kashani <mkashani@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_hw.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 1cffdcc54df..9abd1770a9b 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -14629,10 +14629,18 @@ mlx5_hw_mirror_destroy(struct rte_eth_dev *dev, struct mlx5_mirror *mirror)
 	uint32_t i;
 
 	mlx5_indirect_list_remove_entry(&mirror->indirect);
-	for (i = 0; i < mirror->clones_num; i++)
-		mlx5_mirror_destroy_clone(dev, &mirror->clone[i]);
+	/*
+	 * The mirror action is a composite dest_array that references each
+	 * clone destination (jump table or Rx queue). It must be destroyed
+	 * before the clones so the underlying destinations are no longer
+	 * referenced when they are released; otherwise releasing a clone can
+	 * drop the last reference to a group table and destroy it while the
+	 * dest_array still points at it, leaking the firmware flow table.
+	 */
 	if (mirror->mirror_action)
 		mlx5dr_action_destroy(mirror->mirror_action);
+	for (i = 0; i < mirror->clones_num; i++)
+		mlx5_mirror_destroy_clone(dev, &mirror->clone[i]);
 	mlx5_free(mirror);
 }
 
-- 
2.21.0


                 reply	other threads:[~2026-08-16  8:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260816081525.166446-1-mkashani@nvidia.com \
    --to=mkashani@nvidia.com \
    --cc=bingz@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=getelson@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=suanmingm@nvidia.com \
    --cc=viacheslavo@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