patch 'net/mlx5/hws: fix buddy memory allocation' has been queued to stable release 23.11.6

Shani Peretz shperetz at nvidia.com
Thu Dec 25 10:18:52 CET 2025


Hi,

FYI, your patch has been queued to stable release 23.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/30/25. 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/shanipr/dpdk-stable

This queued commit can be viewed at:
https://github.com/shanipr/dpdk-stable/commit/0811aec6ad49ac3a5f3296af8ee97bb6b6ee709e

Thanks.

Shani

---
>From 0811aec6ad49ac3a5f3296af8ee97bb6b6ee709e Mon Sep 17 00:00:00 2001
From: Nupur Uttarwar <nuttarwar at nvidia.com>
Date: Wed, 12 Nov 2025 09:47:39 +0200
Subject: [PATCH] net/mlx5/hws: fix buddy memory allocation

[ upstream commit 8d1fe10768d2749d00ceb7124866c61d31164380 ]

`buddy` was erroroneously declared as static. When multiple
threads call this routine, they set the same static variable
corrupting pool data and can cause potential double free when
releasing resources.

Fixes: b4dd7bcb0dcb ("net/mlx5/hws: add pool and buddy")

Signed-off-by: Nupur Uttarwar <nuttarwar at nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski at nvidia.com>
---
 .mailmap                            | 1 +
 drivers/net/mlx5/hws/mlx5dr_buddy.c | 1 +
 drivers/net/mlx5/hws/mlx5dr_pool.c  | 3 +--
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/.mailmap b/.mailmap
index 1296224156..5298e5dd6a 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1078,6 +1078,7 @@ Nizan Zorea <nizan.zorea at intel.com>
 Noa Ezra <noae at mellanox.com>
 Nobuhiro Miki <nmiki at yahoo-corp.jp>
 Norbert Ciosek <norbertx.ciosek at intel.com>
+Nupur Uttarwar <nuttarwar at nvidia.com>
 Odi Assli <odia at nvidia.com>
 Ofer Dagan <ofer.d at claroty.com>
 Ognjen Joldzic <ognjen.joldzic at gmail.com>
diff --git a/drivers/net/mlx5/hws/mlx5dr_buddy.c b/drivers/net/mlx5/hws/mlx5dr_buddy.c
index 394ca71217..abfbdf1be5 100644
--- a/drivers/net/mlx5/hws/mlx5dr_buddy.c
+++ b/drivers/net/mlx5/hws/mlx5dr_buddy.c
@@ -147,6 +147,7 @@ void mlx5dr_buddy_cleanup(struct mlx5dr_buddy_mem *buddy)
 
 	simple_free(buddy->num_free);
 	simple_free(buddy->bits);
+	simple_free(buddy);
 }
 
 int mlx5dr_buddy_alloc_mem(struct mlx5dr_buddy_mem *buddy, int order)
diff --git a/drivers/net/mlx5/hws/mlx5dr_pool.c b/drivers/net/mlx5/hws/mlx5dr_pool.c
index b7b532c7cf..a99182e0ca 100644
--- a/drivers/net/mlx5/hws/mlx5dr_pool.c
+++ b/drivers/net/mlx5/hws/mlx5dr_pool.c
@@ -167,7 +167,7 @@ static struct mlx5dr_buddy_mem *
 mlx5dr_pool_buddy_get_next_buddy(struct mlx5dr_pool *pool, int idx,
 				 uint32_t order, bool *is_new_buddy)
 {
-	static struct mlx5dr_buddy_mem *buddy;
+	struct mlx5dr_buddy_mem *buddy;
 	uint32_t new_buddy_size;
 
 	buddy = pool->db.buddy_manager->buddies[idx];
@@ -271,7 +271,6 @@ static void mlx5dr_pool_buddy_db_uninit(struct mlx5dr_pool *pool)
 		buddy = pool->db.buddy_manager->buddies[i];
 		if (buddy) {
 			mlx5dr_buddy_cleanup(buddy);
-			simple_free(buddy);
 			pool->db.buddy_manager->buddies[i] = NULL;
 		}
 	}
-- 
2.43.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2025-12-25 11:16:40.832800636 +0200
+++ 0091-net-mlx5-hws-fix-buddy-memory-allocation.patch	2025-12-25 11:16:36.253823000 +0200
@@ -1 +1 @@
-From 8d1fe10768d2749d00ceb7124866c61d31164380 Mon Sep 17 00:00:00 2001
+From 0811aec6ad49ac3a5f3296af8ee97bb6b6ee709e Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 8d1fe10768d2749d00ceb7124866c61d31164380 ]
+
@@ -22 +24 @@
-index f9c5622e5d..efc66fd48c 100644
+index 1296224156..5298e5dd6a 100644
@@ -25 +27,2 @@
-@@ -1180,6 +1180,7 @@ Noa Ezra <noae at mellanox.com>
+@@ -1078,6 +1078,7 @@ Nizan Zorea <nizan.zorea at intel.com>
+ Noa Ezra <noae at mellanox.com>
@@ -28 +30,0 @@
- Norbert Zulinski <norbertx.zulinski at intel.com>
@@ -46 +48 @@
-index 8e3718ac42..e383027d3e 100644
+index b7b532c7cf..a99182e0ca 100644


More information about the stable mailing list