[dpdk-stable] patch 'net/bnxt: fix memory leak' has been queued to LTS release 17.11.10

luca.boccassi at gmail.com luca.boccassi at gmail.com
Thu Dec 19 15:33:57 CET 2019


Hi,

FYI, your patch has been queued to LTS release 17.11.10

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/21/19. 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.

Thanks.

Luca Boccassi

---
>From 318e5f390a4fae5057bb3ac134d18c5b4267c54d Mon Sep 17 00:00:00 2001
From: Kalesh AP <kalesh-anakkur.purayil at broadcom.com>
Date: Thu, 24 Oct 2019 13:14:31 +0530
Subject: [PATCH] net/bnxt: fix memory leak

[ upstream commit f5019a53d7fc82474710c98bb48b4a09ee07c9f7 ]

During hot fw upgrade or error recovery, driver does cleanup and
reallocation of resources. But driver reallocates memory for ring
group info table without freeing the allocated memory during
device init.

Fix this memory leak by moving the freeing of ring group info table
to bnxt_free_mem() in bnxt_uninit_resources().

Fixes: c09f57b49c13 ("net/bnxt: add start/stop/link update operations")

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil at broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur at broadcom.com>
Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur at broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 7610626306..1a6d09f9d3 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -125,6 +125,9 @@ static void bnxt_free_mem(struct bnxt *bp)
 	bnxt_free_tx_rings(bp);
 	bnxt_free_rx_rings(bp);
 	bnxt_free_def_cp_ring(bp);
+
+	rte_free(bp->grp_info);
+	bp->grp_info = NULL;
 }
 
 static int bnxt_alloc_mem(struct bnxt *bp)
@@ -3079,10 +3082,6 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev) {
 		rte_free(eth_dev->data->mac_addrs);
 		eth_dev->data->mac_addrs = NULL;
 	}
-	if (bp->grp_info != NULL) {
-		rte_free(bp->grp_info);
-		bp->grp_info = NULL;
-	}
 	rc = bnxt_hwrm_func_driver_unregister(bp, 0);
 	bnxt_free_hwrm_resources(bp);
 	rte_memzone_free((const struct rte_memzone *)bp->tx_mem_zone);
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-12-19 14:32:29.930625309 +0000
+++ 0090-net-bnxt-fix-memory-leak.patch	2019-12-19 14:32:26.217300046 +0000
@@ -1,8 +1,10 @@
-From f5019a53d7fc82474710c98bb48b4a09ee07c9f7 Mon Sep 17 00:00:00 2001
+From 318e5f390a4fae5057bb3ac134d18c5b4267c54d Mon Sep 17 00:00:00 2001
 From: Kalesh AP <kalesh-anakkur.purayil at broadcom.com>
 Date: Thu, 24 Oct 2019 13:14:31 +0530
 Subject: [PATCH] net/bnxt: fix memory leak
 
+[ upstream commit f5019a53d7fc82474710c98bb48b4a09ee07c9f7 ]
+
 During hot fw upgrade or error recovery, driver does cleanup and
 reallocation of resources. But driver reallocates memory for ring
 group info table without freeing the allocated memory during
@@ -12,41 +14,39 @@
 to bnxt_free_mem() in bnxt_uninit_resources().
 
 Fixes: c09f57b49c13 ("net/bnxt: add start/stop/link update operations")
-Cc: stable at dpdk.org
 
 Signed-off-by: Kalesh AP <kalesh-anakkur.purayil at broadcom.com>
 Signed-off-by: Somnath Kotur <somnath.kotur at broadcom.com>
 Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur at broadcom.com>
 ---
- drivers/net/bnxt/bnxt_ethdev.c | 8 +++-----
- 1 file changed, 3 insertions(+), 5 deletions(-)
+ drivers/net/bnxt/bnxt_ethdev.c | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
-index 013b968355..9642796eeb 100644
+index 7610626306..1a6d09f9d3 100644
 --- a/drivers/net/bnxt/bnxt_ethdev.c
 +++ b/drivers/net/bnxt/bnxt_ethdev.c
-@@ -183,6 +183,9 @@ static void bnxt_free_mem(struct bnxt *bp, bool reconfig)
- 	}
- 	bnxt_free_async_cp_ring(bp);
- 	bnxt_free_rxtx_nq_ring(bp);
+@@ -125,6 +125,9 @@ static void bnxt_free_mem(struct bnxt *bp)
+ 	bnxt_free_tx_rings(bp);
+ 	bnxt_free_rx_rings(bp);
+ 	bnxt_free_def_cp_ring(bp);
 +
 +	rte_free(bp->grp_info);
 +	bp->grp_info = NULL;
  }
  
- static int bnxt_alloc_mem(struct bnxt *bp, bool reconfig)
-@@ -4821,11 +4824,6 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev)
- 
- 	rc = bnxt_uninit_resources(bp, false);
- 
+ static int bnxt_alloc_mem(struct bnxt *bp)
+@@ -3079,10 +3082,6 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev) {
+ 		rte_free(eth_dev->data->mac_addrs);
+ 		eth_dev->data->mac_addrs = NULL;
+ 	}
 -	if (bp->grp_info != NULL) {
 -		rte_free(bp->grp_info);
 -		bp->grp_info = NULL;
 -	}
--
- 	if (bp->tx_mem_zone) {
- 		rte_memzone_free((const struct rte_memzone *)bp->tx_mem_zone);
- 		bp->tx_mem_zone = NULL;
+ 	rc = bnxt_hwrm_func_driver_unregister(bp, 0);
+ 	bnxt_free_hwrm_resources(bp);
+ 	rte_memzone_free((const struct rte_memzone *)bp->tx_mem_zone);
 -- 
 2.20.1
 


More information about the stable mailing list