diff mbox series

[07/10] net/bnxt: fix a memory leak in port stop

Message ID 20200113043609.27363-8-kalesh-anakkur.purayil@broadcom.com (mailing list archive)
State Superseded, archived
Delegated to: Ajit Khaparde
Headers show
Series bnxt patch set with fixes | expand

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Kalesh A P Jan. 13, 2020, 4:36 a.m. UTC
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

The memory for mark table is allocated during port start.
But the allocated memory is freed only during port close
or driver unload which in turn causes a memory leakage
on each port start/stop.

Fixed it by moving the memory free to port stop.

Fixes: 4e40794a18a7 ("net/bnxt: add support for flow mark action")

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 436ecbb..2661418 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -970,7 +970,10 @@  static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
 	bnxt_int_handler(eth_dev);
 	bnxt_shutdown_nic(bp);
 	bnxt_hwrm_if_change(bp, 0);
-	memset(bp->mark_table, 0, BNXT_MARK_TABLE_SZ);
+
+	rte_free(bp->mark_table);
+	bp->mark_table = NULL;
+
 	bp->flags &= ~BNXT_FLAG_RX_VECTOR_PKT_MODE;
 	bp->dev_stopped = 1;
 	bp->rx_cosq_cnt = 0;
@@ -992,9 +995,6 @@  static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
 		bp->grp_info = NULL;
 	}
 
-	rte_free(bp->mark_table);
-	bp->mark_table = NULL;
-
 	bnxt_dev_uninit(eth_dev);
 }