From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by dpdk.org (Postfix) with ESMTP id D02AF4F98 for ; Tue, 14 Aug 2018 13:07:10 +0200 (CEST) Received: from 1.general.paelzer.uk.vpn ([10.172.196.172] helo=lap.fritz.box) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpXAM-0000wO-NM; Tue, 14 Aug 2018 11:07:10 +0000 From: Christian Ehrhardt To: Ajit Khaparde Cc: Somnath Kotur , Ray Jui , Michael Wildt , Randy Schacher , dpdk stable Date: Tue, 14 Aug 2018 13:06:16 +0200 Message-Id: <20180814110651.25277-13-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180814110651.25277-1-christian.ehrhardt@canonical.com> References: <20180814110651.25277-1-christian.ehrhardt@canonical.com> Subject: [dpdk-stable] patch 'net/bnxt: fix memory leaks in NVM commands' has been queued to stable release 18.05.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Aug 2018 11:07:10 -0000 Hi, FYI, your patch has been queued to stable release 18.05.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/16/18. So please shout if anyone has objections. Thanks. Christian Ehrhardt --- >>From 6e664dcb2dee1760a5957aefcf12dfe7b40250a0 Mon Sep 17 00:00:00 2001 From: Ajit Khaparde Date: Wed, 25 Jul 2018 18:15:45 -0700 Subject: [PATCH] net/bnxt: fix memory leaks in NVM commands [ upstream commit 6621ae146166adaba8dc4c120ad8c0fabab95830 ] In some cases we may not be freeing up memory allocated for certain NVM commands because the code might have bailed out before reaching rte_free(). This patch moves some code around to ensure the allocated memory is freed before exiting the function. Fixes: 19e6af01bb36 ("net/bnxt: support get/set EEPROM") Signed-off-by: Ajit Khaparde Reviewed-by: Somnath Kotur Reviewed-by: Ray Jui Reviewed-by: Michael Wildt Reviewed-by: Randy Schacher --- drivers/net/bnxt/bnxt_hwrm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 8d8104a19..714871eb2 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -3310,13 +3310,12 @@ int bnxt_get_nvram_directory(struct bnxt *bp, uint32_t len, uint8_t *data) req.host_dest_addr = rte_cpu_to_le_64(dma_handle); rc = bnxt_hwrm_send_message(bp, &req, sizeof(req)); - HWRM_CHECK_RESULT(); - HWRM_UNLOCK(); - if (rc == 0) memcpy(data, buf, len > buflen ? buflen : len); rte_free(buf); + HWRM_CHECK_RESULT(); + HWRM_UNLOCK(); return rc; } @@ -3348,12 +3347,13 @@ int bnxt_hwrm_get_nvram_item(struct bnxt *bp, uint32_t index, req.offset = rte_cpu_to_le_32(offset); req.len = rte_cpu_to_le_32(length); rc = bnxt_hwrm_send_message(bp, &req, sizeof(req)); - HWRM_CHECK_RESULT(); - HWRM_UNLOCK(); if (rc == 0) memcpy(data, buf, length); rte_free(buf); + HWRM_CHECK_RESULT(); + HWRM_UNLOCK(); + return rc; } @@ -3408,10 +3408,10 @@ int bnxt_hwrm_flash_nvram(struct bnxt *bp, uint16_t dir_type, rc = bnxt_hwrm_send_message(bp, &req, sizeof(req)); + rte_free(buf); HWRM_CHECK_RESULT(); HWRM_UNLOCK(); - rte_free(buf); return rc; } -- 2.17.1