From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B49F5A32A1 for ; Thu, 24 Oct 2019 08:09:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 897621C2B5; Thu, 24 Oct 2019 08:08:15 +0200 (CEST) Received: from relay.smtp.broadcom.com (relay.smtp.broadcom.com [192.19.211.62]) by dpdk.org (Postfix) with ESMTP id A9F2A1C190 for ; Thu, 24 Oct 2019 08:07:01 +0200 (CEST) Received: from dhcp-10-123-153-55.dhcp.broadcom.net (bgccx-dev-host-lnx35.bec.broadcom.net [10.123.153.55]) by relay.smtp.broadcom.com (Postfix) with ESMTP id 3300E28FAC5; Wed, 23 Oct 2019 23:07:01 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com 3300E28FAC5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1571897221; bh=JvmRPx2aeQSY8jooCeBPKI++BsMEOzDm2GnMz3hdTf0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kN3r3ABGlH3J/fxk7sjv+X+NAX009N1gUhCM5uhWoJA0gXV0e9+lfYVWdZfVPLDEJ PMLEmkZd+21mzOHrlT/rLSR/2BtXq74ch6+ddkGqrVH5qAT73FDhtWzx4CJa3T2VOd DyR30VB+EHHDgPwBA8Ky3GpisYvOoRmPZZcsoGys= From: Somnath Kotur To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Thu, 24 Oct 2019 11:29:11 +0530 Message-Id: <20191024055913.28817-17-somnath.kotur@broadcom.com> X-Mailer: git-send-email 2.10.1.613.g2cc2e70 In-Reply-To: <20191024055913.28817-1-somnath.kotur@broadcom.com> References: <20191024055913.28817-1-somnath.kotur@broadcom.com> Subject: [dpdk-dev] [PATCH 16/16] net/bnxt: fix a possible memory leak X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Kalesh AP 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: 4617e2125c7f ("net/bnxt: refactor init and uninit functions") Signed-off-by: Kalesh AP Reviewed-by: Santoshkumar Karanappa Rastapur Signed-off-by: Somnath Kotur --- drivers/net/bnxt/bnxt_ethdev.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 013b968..9642796 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); + + rte_free(bp->grp_info); + bp->grp_info = NULL; } static int bnxt_alloc_mem(struct bnxt *bp, bool reconfig) @@ -4821,11 +4824,6 @@ static int bnxt_init_resources(struct bnxt *bp, bool reconfig_dev) rc = bnxt_uninit_resources(bp, false); - 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; -- 1.8.3.1