patch 'net/nfb: fix bad pointer access in queue stats' has been queued to stable release 24.11.5

luca.boccassi at gmail.com luca.boccassi at gmail.com
Fri Feb 20 15:56:14 CET 2026


Hi,

FYI, your patch has been queued to stable release 24.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 02/22/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/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/40da80f639a28158027d3153fdc6aa14dbae7ded

Thanks.

Luca Boccassi

---
>From 40da80f639a28158027d3153fdc6aa14dbae7ded Mon Sep 17 00:00:00 2001
From: Martin Spinler <spinler at cesnet.cz>
Date: Mon, 2 Feb 2026 20:33:26 +0100
Subject: [PATCH] net/nfb: fix bad pointer access in queue stats

[ upstream commit 5052a816aead1ba09cc11b7d9cf080cdae1de869 ]

The driver code has dereferenced the dev->data->rx_queues pointer
without checking for its validity.
Pointer invalidation can occur when the eth_dev_rx_queue_config
is called with set to 0, for example.

Moreover, an array of pointers (to a structure) was used like array
of structures (which worked with early dereference just for one queue).

Fixes: 6435f9a0ac22 ("net/nfb: add new netcope driver")

Signed-off-by: Martin Spinler <spinler at cesnet.cz>
---
 drivers/net/nfb/nfb_stats.c | 57 +++++++++++++++++++++----------------
 1 file changed, 32 insertions(+), 25 deletions(-)

diff --git a/drivers/net/nfb/nfb_stats.c b/drivers/net/nfb/nfb_stats.c
index e107dff4b9..cc41445de3 100644
--- a/drivers/net/nfb/nfb_stats.c
+++ b/drivers/net/nfb/nfb_stats.c
@@ -20,28 +20,31 @@ nfb_eth_stats_get(struct rte_eth_dev *dev,
 	uint64_t rx_total_bytes = 0;
 	uint64_t tx_total_bytes = 0;
 
-	struct ndp_rx_queue *rx_queue = *((struct ndp_rx_queue **)
-		dev->data->rx_queues);
-	struct ndp_tx_queue *tx_queue = *((struct ndp_tx_queue **)
-		dev->data->tx_queues);
-
 	for (i = 0; i < nb_rx; i++) {
+		struct ndp_rx_queue *rx_queue = dev->data->rx_queues[i];
+		if (rx_queue == NULL)
+			continue;
+
 		if (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
-			stats->q_ipackets[i] = rx_queue[i].rx_pkts;
-			stats->q_ibytes[i] = rx_queue[i].rx_bytes;
+			stats->q_ipackets[i] = rx_queue->rx_pkts;
+			stats->q_ibytes[i] = rx_queue->rx_bytes;
 		}
-		rx_total += rx_queue[i].rx_pkts;
-		rx_total_bytes += rx_queue[i].rx_bytes;
+		rx_total += rx_queue->rx_pkts;
+		rx_total_bytes += rx_queue->rx_bytes;
 	}
 
 	for (i = 0; i < nb_tx; i++) {
+		struct ndp_tx_queue *tx_queue = dev->data->tx_queues[i];
+		if (tx_queue == NULL)
+			continue;
+
 		if (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
-			stats->q_opackets[i] = tx_queue[i].tx_pkts;
-			stats->q_obytes[i] = tx_queue[i].tx_bytes;
+			stats->q_opackets[i] = tx_queue->tx_pkts;
+			stats->q_obytes[i] = tx_queue->tx_bytes;
 		}
-		tx_total += tx_queue[i].tx_pkts;
-		tx_total_bytes += tx_queue[i].tx_bytes;
-		tx_err_total += tx_queue[i].err_pkts;
+		tx_total += tx_queue->tx_pkts;
+		tx_total_bytes += tx_queue->tx_bytes;
+		tx_err_total += tx_queue->err_pkts;
 	}
 
 	stats->ipackets = rx_total;
@@ -59,20 +62,24 @@ nfb_eth_stats_reset(struct rte_eth_dev *dev)
 	uint16_t nb_rx = dev->data->nb_rx_queues;
 	uint16_t nb_tx = dev->data->nb_tx_queues;
 
-	struct ndp_rx_queue *rx_queue = *((struct ndp_rx_queue **)
-		dev->data->rx_queues);
-	struct ndp_tx_queue *tx_queue = *((struct ndp_tx_queue **)
-		dev->data->tx_queues);
-
 	for (i = 0; i < nb_rx; i++) {
-		rx_queue[i].rx_pkts = 0;
-		rx_queue[i].rx_bytes = 0;
-		rx_queue[i].err_pkts = 0;
+		struct ndp_rx_queue *rx_queue = dev->data->rx_queues[i];
+		if (rx_queue == NULL)
+			continue;
+
+		rx_queue->rx_pkts = 0;
+		rx_queue->rx_bytes = 0;
+		rx_queue->err_pkts = 0;
 	}
+
 	for (i = 0; i < nb_tx; i++) {
-		tx_queue[i].tx_pkts = 0;
-		tx_queue[i].tx_bytes = 0;
-		tx_queue[i].err_pkts = 0;
+		struct ndp_tx_queue *tx_queue = dev->data->tx_queues[i];
+		if (tx_queue == NULL)
+			continue;
+
+		tx_queue->tx_pkts = 0;
+		tx_queue->tx_bytes = 0;
+		tx_queue->err_pkts = 0;
 	}
 
 	return 0;
-- 
2.47.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-02-20 14:55:46.007395008 +0000
+++ 0072-net-nfb-fix-bad-pointer-access-in-queue-stats.patch	2026-02-20 14:55:43.272192227 +0000
@@ -1 +1 @@
-From 5052a816aead1ba09cc11b7d9cf080cdae1de869 Mon Sep 17 00:00:00 2001
+From 40da80f639a28158027d3153fdc6aa14dbae7ded Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 5052a816aead1ba09cc11b7d9cf080cdae1de869 ]
+
@@ -15 +16,0 @@
-Cc: stable at dpdk.org
@@ -23 +24 @@
-index 4ea6b7be21..303c85824e 100644
+index e107dff4b9..cc41445de3 100644
@@ -26 +27 @@
-@@ -20,28 +20,31 @@ nfb_eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats,
+@@ -20,28 +20,31 @@ nfb_eth_stats_get(struct rte_eth_dev *dev,
@@ -40,5 +41,5 @@
- 		if (qstats && i < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
--			qstats->q_ipackets[i] = rx_queue[i].rx_pkts;
--			qstats->q_ibytes[i] = rx_queue[i].rx_bytes;
-+			qstats->q_ipackets[i] = rx_queue->rx_pkts;
-+			qstats->q_ibytes[i] = rx_queue->rx_bytes;
+ 		if (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
+-			stats->q_ipackets[i] = rx_queue[i].rx_pkts;
+-			stats->q_ibytes[i] = rx_queue[i].rx_bytes;
++			stats->q_ipackets[i] = rx_queue->rx_pkts;
++			stats->q_ibytes[i] = rx_queue->rx_bytes;
@@ -57,5 +58,5 @@
- 		if (qstats && i < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
--			qstats->q_opackets[i] = tx_queue[i].tx_pkts;
--			qstats->q_obytes[i] = tx_queue[i].tx_bytes;
-+			qstats->q_opackets[i] = tx_queue->tx_pkts;
-+			qstats->q_obytes[i] = tx_queue->tx_bytes;
+ 		if (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
+-			stats->q_opackets[i] = tx_queue[i].tx_pkts;
+-			stats->q_obytes[i] = tx_queue[i].tx_bytes;
++			stats->q_opackets[i] = tx_queue->tx_pkts;
++			stats->q_obytes[i] = tx_queue->tx_bytes;


More information about the stable mailing list