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 A4A41A09E9 for ; Tue, 8 Dec 2020 21:58:27 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 57DCEA3; Tue, 8 Dec 2020 21:58:26 +0100 (CET) Received: from mail-qv1-f68.google.com (mail-qv1-f68.google.com [209.85.219.68]) by dpdk.org (Postfix) with ESMTP id 7DAFC72D9 for ; Tue, 8 Dec 2020 21:58:24 +0100 (CET) Received: by mail-qv1-f68.google.com with SMTP id n9so8921677qvp.5 for ; Tue, 08 Dec 2020 12:58:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6cf/KO77/T5vB/731qNCSVRveV82Di+vkeD8wu9d6i8=; b=WGpkAwZxASerCx7dR7zf2NVw2kZ3eGP05kZQdCNZ81tg+Qgln0Z22Jmrbw2YM/e7h8 okEBzgqPsV25/7g2j3PZ8KYetCmV+2ytjnsCuZ/FQkjZmxPt6sSkYc7XZsEcXXnvXcrC 5uknxJTQE26JFftYrOMQ0OEU7/Z8/sQXXJxsE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6cf/KO77/T5vB/731qNCSVRveV82Di+vkeD8wu9d6i8=; b=MepxQmZf89G+EHVmfS2dfeaT9bE5iKapAw+9n3d1zgMoyqxvwLPSf8l9+X4ezbdSRJ KccTAHQvfzPQGsjlxlM5KSeIy+DXpDwypwCHc1moAg+iWupNaEJCjS6HePP0VGbi4fBj 5H9Q5Zr10ih6lD1pN4T+f1ktsFCy99eH9WnkhvE/P/d7HWjE9W/tnSavDeRn7TZQNy4C CZ+/g9GOEzwF+99goYoWCD7fRb7bfdzWFhyfAiBaiPQdOVxT83ij8OeSoTeeg7b8AJML vbit+bIU1/kRmsohPbK0TtNKdpW45dBk8msyYDrcCzOYOGDcj+HmEP+qEF4ZlFVdub+K ibRA== X-Gm-Message-State: AOAM5337JIK1KJL6F73wLwlnmv19Yt4Laq7xB0dATVw5DLanowJaINu3 RidEQ2mq1BmFk1zUZgWLcm8LIyJ5yc195mpbT+MPpUrSdGwkuwszY925sjl30nSG1FXE7UFepAj Oy9m4AZXSo8rjkw== X-Google-Smtp-Source: ABdhPJwx/a5c0+HSQWjklfEa3eKd55wO3nx1H0WaGPjM3I4SsMfPNgY+UyZCUCG7KQ7Bj7VJx1MfgsKZe9CxPtefY5A= X-Received: by 2002:ad4:5188:: with SMTP id b8mr7705349qvp.55.1607461102565; Tue, 08 Dec 2020 12:58:22 -0800 (PST) MIME-Version: 1.0 References: <1606784374-32388-1-git-send-email-wangyunjian@huawei.com> In-Reply-To: <1606784374-32388-1-git-send-email-wangyunjian@huawei.com> From: Ajit Khaparde Date: Tue, 8 Dec 2020 12:58:06 -0800 Message-ID: To: wangyunjian Cc: dpdk-dev , Somnath Kotur , "Lilijun (Jerry)" , xudingke , dpdk stable Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] net/bnxt: fix memory leak when mapping failure 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: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Mon, Nov 30, 2020 at 5:00 PM wangyunjian wrote: > > From: Yunjian Wang > > We allocated memory for the 'buf' when sending message to HWRM, > but we don't free it when mapping the address to IO address > fails. It will lead to memory leak. > > Fixes: 19e6af01bb36 ("net/bnxt: support get/set EEPROM") > Cc: stable@dpdk.org > > Signed-off-by: Yunjian Wang Patch applied to dpdk-next-net-brcm. Thanks > --- > drivers/net/bnxt/bnxt_hwrm.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c > index 24c33185b4..ebbf504c0c 100644 > --- a/drivers/net/bnxt/bnxt_hwrm.c > +++ b/drivers/net/bnxt/bnxt_hwrm.c > @@ -4320,6 +4320,7 @@ int bnxt_get_nvram_directory(struct bnxt *bp, uint32_t len, uint8_t *data) > return -ENOMEM; > dma_handle = rte_malloc_virt2iova(buf); > if (dma_handle == RTE_BAD_IOVA) { > + rte_free(buf); > PMD_DRV_LOG(ERR, > "unable to map response address to physical memory\n"); > return -ENOMEM; > @@ -4354,6 +4355,7 @@ int bnxt_hwrm_get_nvram_item(struct bnxt *bp, uint32_t index, > > dma_handle = rte_malloc_virt2iova(buf); > if (dma_handle == RTE_BAD_IOVA) { > + rte_free(buf); > PMD_DRV_LOG(ERR, > "unable to map response address to physical memory\n"); > return -ENOMEM; > @@ -4407,6 +4409,7 @@ int bnxt_hwrm_flash_nvram(struct bnxt *bp, uint16_t dir_type, > > dma_handle = rte_malloc_virt2iova(buf); > if (dma_handle == RTE_BAD_IOVA) { > + rte_free(buf); > PMD_DRV_LOG(ERR, > "unable to map response address to physical memory\n"); > return -ENOMEM; > -- > 2.18.1 > -- This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it.