[dpdk-stable] patch 'net/iavf: fix mbuf leak' has been queued to stable release 20.11.4

Xueming Li xuemingl at nvidia.com
Wed Nov 10 07:29:17 CET 2021


Hi,

FYI, your patch has been queued to stable release 20.11.4

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

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/474bbafd6f2d216f7d7a2a09e2e98200597f20ad

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 474bbafd6f2d216f7d7a2a09e2e98200597f20ad Mon Sep 17 00:00:00 2001
From: Qiming Chen <chenqiming_huawei at 163.com>
Date: Thu, 16 Sep 2021 22:04:00 +0800
Subject: [PATCH] net/iavf: fix mbuf leak
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 1028e5bc36b4dd4ae51580eb3e45410b6c82e153 ]

In the iavf_dev_rx_queue_start function, if the iavf_switch_queue
or iavf_switch_queue_lv function fails, the previously applied mbuf
is not released, resulting in leakage. The patch fixes the problem.

Fixes: 9cf9c02bf6ee ("net/iavf: add enable/disable queues for large VF")

Signed-off-by: Qiming Chen <chenqiming_huawei at 163.com>
Acked-by: Qi Zhang <qi.z.zhang at intel.com>
---
 drivers/net/iavf/iavf_rxtx.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c
index b0e86f022b..b475aa0cc5 100644
--- a/drivers/net/iavf/iavf_rxtx.c
+++ b/drivers/net/iavf/iavf_rxtx.c
@@ -245,11 +245,15 @@ alloc_rxq_mbufs(struct iavf_rx_queue *rxq)
 	volatile union iavf_rx_desc *rxd;
 	struct rte_mbuf *mbuf = NULL;
 	uint64_t dma_addr;
-	uint16_t i;
+	uint16_t i, j;
 
 	for (i = 0; i < rxq->nb_rx_desc; i++) {
 		mbuf = rte_mbuf_raw_alloc(rxq->mp);
 		if (unlikely(!mbuf)) {
+			for (j = 0; j < i; j++) {
+				rte_pktmbuf_free_seg(rxq->sw_ring[j]);
+				rxq->sw_ring[j] = NULL;
+			}
 			PMD_DRV_LOG(ERR, "Failed to allocate mbuf for RX");
 			return -ENOMEM;
 		}
@@ -757,12 +761,14 @@ iavf_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 	else
 		err = iavf_switch_queue_lv(adapter, rx_queue_id, true, true);
 
-	if (err)
+	if (err) {
+		release_rxq_mbufs(rxq);
 		PMD_DRV_LOG(ERR, "Failed to switch RX queue %u on",
 			    rx_queue_id);
-	else
+	} else {
 		dev->data->rx_queue_state[rx_queue_id] =
 			RTE_ETH_QUEUE_STATE_STARTED;
+	}
 
 	return err;
 }
-- 
2.33.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-11-10 14:17:05.321815673 +0800
+++ 0073-net-iavf-fix-mbuf-leak.patch	2021-11-10 14:17:01.837413030 +0800
@@ -1 +1 @@
-From 1028e5bc36b4dd4ae51580eb3e45410b6c82e153 Mon Sep 17 00:00:00 2001
+From 474bbafd6f2d216f7d7a2a09e2e98200597f20ad Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 1028e5bc36b4dd4ae51580eb3e45410b6c82e153 ]
@@ -11 +13,0 @@
-Cc: stable at dpdk.org
@@ -20 +22 @@
-index 6de8ad3fe3..87afc0b4cb 100644
+index b0e86f022b..b475aa0cc5 100644
@@ -23 +25 @@
-@@ -278,11 +278,15 @@ alloc_rxq_mbufs(struct iavf_rx_queue *rxq)
+@@ -245,11 +245,15 @@ alloc_rxq_mbufs(struct iavf_rx_queue *rxq)
@@ -40 +42 @@
-@@ -852,12 +856,14 @@ iavf_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+@@ -757,12 +761,14 @@ iavf_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)


More information about the stable mailing list