patch 'raw/ntb: fix memory window leaks' has been queued to stable release 25.11.5

Kevin Traynor ktraynor at redhat.com
Thu Dec 3 14:05:59 CET 2026


Hi,

FYI, your patch has been queued to stable release 25.11.5

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/08/26. 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/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/bf2add5b9e47c320878a3095918407ddcabd1356

Thanks.

Kevin

---
>From bf2add5b9e47c320878a3095918407ddcabd1356 Mon Sep 17 00:00:00 2001
From: Raghavendra Ningoji <raghavendra.ningoji at amd.com>
Date: Wed, 11 Nov 2026 12:36:38 +0530
Subject: [PATCH] raw/ntb: fix memory window leaks

[ upstream commit 0997765702da6db1fb8d1de83672dcbe1c8361e7 ]

The memory window size array allocated by the vendor init at probe
time was never freed.
The peer memory window base array allocated at each device start was
only freed if the start failed, so it leaked on every stop/start cycle.

As the number of memory windows is fixed for all supported devices,
embed the memory window size array in the device private data instead
of allocating it: it lives as long as the device and remains valid for
the info get after close.
Free the peer memory window base array when stopping the device.

Fixes: c39d1e082a4b ("raw/ntb: setup queues")
Fixes: d6dc5a7f8b06 ("raw/ntb: support AMD NTB")

Signed-off-by: Raghavendra Ningoji <raghavendra.ningoji at amd.com>
---
 drivers/raw/ntb/ntb.c          | 6 ++++++
 drivers/raw/ntb/ntb.h          | 5 ++++-
 drivers/raw/ntb/ntb_hw_intel.c | 8 +-------
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/raw/ntb/ntb.c b/drivers/raw/ntb/ntb.c
index 45ee39ccd7..86a4cdfc81 100644
--- a/drivers/raw/ntb/ntb.c
+++ b/drivers/raw/ntb/ntb.c
@@ -973,4 +973,6 @@ ntb_dev_start(struct rte_rawdev *dev)
 err_up:
 	rte_free(hw->peer_mw_base);
+	hw->peer_mw_base = NULL;
+	hw->peer_used_mws = 0;
 err_q_init:
 	for (i = 0; i < hw->queue_pairs; i++) {
@@ -1033,4 +1035,8 @@ clean:
 	}
 
+	rte_free(hw->peer_mw_base);
+	hw->peer_mw_base = NULL;
+	hw->peer_used_mws = 0;
+
 	dev->started = 0;
 }
diff --git a/drivers/raw/ntb/ntb.h b/drivers/raw/ntb/ntb.h
index 8c7a2230f9..4eb881d0b8 100644
--- a/drivers/raw/ntb/ntb.h
+++ b/drivers/raw/ntb/ntb.h
@@ -26,4 +26,7 @@ extern int ntb_logtype;
 #define NTB_SPAD_USER_LEN           (sizeof(NTB_SPAD_USER) - 1)
 #define NTB_SPAD_USER_MAX_NUM       4
+
+/* Maximum number of memory windows of supported devices. */
+#define NTB_MAX_MW                  2
 #define NTB_ATTR_NAME_LEN           30
 
@@ -213,5 +216,5 @@ struct ntb_hw {
 
 	uint8_t peer_dev_up;
-	uint64_t *mw_size;
+	uint64_t mw_size[NTB_MAX_MW];
 	/* remote mem base addr */
 	uint64_t *peer_mw_base;
diff --git a/drivers/raw/ntb/ntb_hw_intel.c b/drivers/raw/ntb/ntb_hw_intel.c
index 30009c8f64..630755e20c 100644
--- a/drivers/raw/ntb/ntb_hw_intel.c
+++ b/drivers/raw/ntb/ntb_hw_intel.c
@@ -194,15 +194,9 @@ intel_ntb_dev_init(const struct rte_rawdev *dev)
 		return ret;
 
+	RTE_BUILD_BUG_ON(XEON_MW_COUNT > NTB_MAX_MW);
 	hw->mw_cnt = XEON_MW_COUNT;
 	hw->db_cnt = XEON_DB_COUNT;
 	hw->spad_cnt = XEON_SPAD_COUNT;
 
-	hw->mw_size = rte_zmalloc("ntb_mw_size",
-				  hw->mw_cnt * sizeof(uint64_t), 0);
-	if (hw->mw_size == NULL) {
-		NTB_LOG(ERR, "Cannot allocate memory for mw size.");
-		return -ENOMEM;
-	}
-
 	for (i = 0; i < hw->mw_cnt; i++) {
 		bar = intel_ntb_bar[i];
-- 
2.56.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-12-03 12:52:51.440365473 +0000
+++ 0433-raw-ntb-fix-memory-window-leaks.patch	2026-12-03 12:52:39.334562384 +0000
@@ -1 +1 @@
-From 0997765702da6db1fb8d1de83672dcbe1c8361e7 Mon Sep 17 00:00:00 2001
+From bf2add5b9e47c320878a3095918407ddcabd1356 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 0997765702da6db1fb8d1de83672dcbe1c8361e7 ]
+
@@ -19 +20,0 @@
-Cc: stable at dpdk.org
@@ -25 +25,0 @@
- drivers/raw/ntb/ntb_hw_amd.c   | 6 +-----
@@ -27 +27 @@
- 4 files changed, 12 insertions(+), 13 deletions(-)
+ 3 files changed, 11 insertions(+), 8 deletions(-)
@@ -30 +30 @@
-index e42af0b9c5..5985604cce 100644
+index 45ee39ccd7..86a4cdfc81 100644
@@ -33 +33 @@
-@@ -821,4 +821,6 @@ ntb_dev_start(struct rte_rawdev *dev)
+@@ -973,4 +973,6 @@ ntb_dev_start(struct rte_rawdev *dev)
@@ -40 +40 @@
-@@ -873,4 +875,8 @@ clean:
+@@ -1033,4 +1035,8 @@ clean:
@@ -50 +50 @@
-index 0181bec5c9..31bf0f3260 100644
+index 8c7a2230f9..4eb881d0b8 100644
@@ -53 +53 @@
-@@ -18,4 +18,7 @@ extern int ntb_logtype;
+@@ -26,4 +26,7 @@ extern int ntb_logtype;
@@ -61 +61 @@
-@@ -221,5 +224,5 @@ struct ntb_hw {
+@@ -213,5 +216,5 @@ struct ntb_hw {
@@ -68,20 +67,0 @@
-diff --git a/drivers/raw/ntb/ntb_hw_amd.c b/drivers/raw/ntb/ntb_hw_amd.c
-index 64075501c2..9b274bc6b9 100644
---- a/drivers/raw/ntb/ntb_hw_amd.c
-+++ b/drivers/raw/ntb/ntb_hw_amd.c
-@@ -54,4 +54,5 @@ amd_ntb_dev_init(const struct rte_rawdev *dev)
- 		ntb->topo == NTB_TOPO_SEC ? "secondary" : "primary", sideinfo);
- 
-+	RTE_BUILD_BUG_ON(AMD_MW_COUNT > NTB_MAX_MW);
- 	ntb->mw_cnt = AMD_MW_COUNT;
- 	ntb->db_cnt = AMD_DB_COUNT;
-@@ -61,9 +62,4 @@ amd_ntb_dev_init(const struct rte_rawdev *dev)
- 	ntb->spad_cnt = AMD_SPAD_PER_SIDE;
- 
--	ntb->mw_size = rte_zmalloc("ntb_mw_size", ntb->mw_cnt * sizeof(uint64_t), 0);
--	if (ntb->mw_size == NULL) {
--		NTB_LOG(ERR, "Cannot allocate memory for mw size.");
--		return -ENOMEM;
--	}
- 	for (i = 0; i < ntb->mw_cnt; i++) {
- 		bar = amd_ntb_bar[i];
@@ -89 +69 @@
-index 47d5d39339..ad8e330199 100644
+index 30009c8f64..630755e20c 100644
@@ -92 +72 @@
-@@ -195,15 +195,9 @@ intel_ntb_dev_init(const struct rte_rawdev *dev)
+@@ -194,15 +194,9 @@ intel_ntb_dev_init(const struct rte_rawdev *dev)



More information about the stable mailing list