patch 'net/ice: fix memory leak in scalar Rx' has been queued to stable release 23.11.4

Xueming Li xuemingl at nvidia.com
Tue Feb 18 13:34:12 CET 2025


Hi,

FYI, your patch has been queued to stable release 23.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
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://git.dpdk.org/dpdk-stable/log/?h=23.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=fb6aaabf7945b8fd242286cd69368b5cf42a4a91

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From fb6aaabf7945b8fd242286cd69368b5cf42a4a91 Mon Sep 17 00:00:00 2001
From: Vladimir Medvedkin <vladimir.medvedkin at intel.com>
Date: Fri, 17 Jan 2025 17:52:05 +0000
Subject: [PATCH] net/ice: fix memory leak in scalar Rx
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 07cbd0b43ce4af9d628c8ad751789934d0a8c4a7 ]

If the buffer splitting feature is configured and the payload mbuf
allocation fails, the previously allocated header mbuf may be returned
not fully initialized or a memory leak may occur.  This patch handles
this case correctly by freeing the corresponding header buffer.

Fixes: 629dad3ef325 ("net/ice: support buffer split in scalar Rx")

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin at intel.com>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
---
 drivers/net/ice/ice_rxtx.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 644d106814..6af16f9aed 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -484,6 +484,7 @@ ice_alloc_rx_queue_mbufs(struct ice_rx_queue *rxq)
 			struct rte_mbuf *mbuf_pay;
 			mbuf_pay = rte_mbuf_raw_alloc(rxq->rxseg[1].mp);
 			if (unlikely(!mbuf_pay)) {
+				rte_pktmbuf_free(mbuf);
 				PMD_DRV_LOG(ERR, "Failed to allocate payload mbuf for RX");
 				return -ENOMEM;
 			}
@@ -1874,6 +1875,8 @@ ice_rx_alloc_bufs(struct ice_rx_queue *rxq)
 		diag_pay = rte_mempool_get_bulk(rxq->rxseg[1].mp,
 				(void *)mbufs_pay, rxq->rx_free_thresh);
 		if (unlikely(diag_pay != 0)) {
+			rte_mempool_put_bulk(rxq->mp, (void *)rxep,
+				    rxq->rx_free_thresh);
 			PMD_RX_LOG(ERR, "Failed to get payload mbufs in bulk");
 			return -ENOMEM;
 		}
@@ -2580,6 +2583,13 @@ ice_recv_pkts(void *rx_queue,
 			nmb_pay = rte_mbuf_raw_alloc(rxq->rxseg[1].mp);
 			if (unlikely(!nmb_pay)) {
 				rxq->vsi->adapter->pf.dev_data->rx_mbuf_alloc_failed++;
+				rxe->mbuf = NULL;
+				nb_hold--;
+				if (unlikely(rx_id == 0))
+					rx_id = rxq->nb_rx_desc;
+
+				rx_id--;
+				rte_pktmbuf_free(nmb);
 				break;
 			}

--
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2025-02-18 19:39:01.356617522 +0800
+++ 0017-net-ice-fix-memory-leak-in-scalar-Rx.patch	2025-02-18 19:39:00.458244077 +0800
@@ -1 +1 @@
-From 07cbd0b43ce4af9d628c8ad751789934d0a8c4a7 Mon Sep 17 00:00:00 2001
+From fb6aaabf7945b8fd242286cd69368b5cf42a4a91 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 07cbd0b43ce4af9d628c8ad751789934d0a8c4a7 ]
@@ -12 +14,0 @@
-Cc: stable at dpdk.org
@@ -21 +23 @@
-index 0c7106c7e0..f58df9bdfe 100644
+index 644d106814..6af16f9aed 100644
@@ -32 +34 @@
-@@ -1900,6 +1901,8 @@ ice_rx_alloc_bufs(struct ice_rx_queue *rxq)
+@@ -1874,6 +1875,8 @@ ice_rx_alloc_bufs(struct ice_rx_queue *rxq)
@@ -41 +43 @@
-@@ -2607,6 +2610,13 @@ ice_recv_pkts(void *rx_queue,
+@@ -2580,6 +2583,13 @@ ice_recv_pkts(void *rx_queue,


More information about the stable mailing list