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 09407A09E9; Tue, 8 Dec 2020 21:58:29 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8D38AC8FA; Tue, 8 Dec 2020 21:58:26 +0100 (CET) Received: from mail-qv1-f65.google.com (mail-qv1-f65.google.com [209.85.219.65]) by dpdk.org (Postfix) with ESMTP id 7AD3BA3 for ; Tue, 8 Dec 2020 21:58:24 +0100 (CET) Received: by mail-qv1-f65.google.com with SMTP id j13so1524817qvi.8 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=0mVgskwLnVk5VR6X+sqaC6jUjyVSfXT0v74GFB73Nu8=; b=YfFxG6edzbVucg7lpUrzwUmso0OSrEaYYOxhFPSuR6TF4kBQKa7btB2gaCXRyrRnUh x3iLd6Y1dGqZmf3PcLNuISVcpQPvs6ceuRlq8jiXkV0dIewDntL0o7n+EJBDR9GUCho+ ZDv1/J1LIIgbgWR/K0nOPj/7mrcdI+RcDhhb0= 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=0mVgskwLnVk5VR6X+sqaC6jUjyVSfXT0v74GFB73Nu8=; b=nqmZMSZxx5ZKN+O+Mc5BHMZ3lP1yQT52hHcytTyCDD1xM7Z3ODelldYXnyCN1/HSkk hc+EKu30WKXbY5ZloQ1YLPS1wvOH+5RMLjdOAjF3SPoRg1IYc9gluj3QWiKNrUJABelP yNB5aTITDwSpe9ddPUM64DH4MYCUsUXw9lkCSeEOXSvDRN2zQvKD510bxMaMzGhfShDT L1LX3AQ8MXtTS3Gwfj368kwfX11rfaEVxaoQLjMaZl1BP4sCINeNJle5Xe7aIEMVPQa4 D0p6c0Ni+dqLw8FyghkIdN29TxNng2ItQBC1/c965VMsJRjkH3YiGvaIcGrTf/a3uRON Mhxg== X-Gm-Message-State: AOAM530kgjfwgrZv0vQAFdaBWiKxzIa/Z2xLK9E03lEs2Lv2GLR7Ze6P JtU1/+gjeL821V3XulsNiCWsfU4i0G8xiJYJ0T9W1kM7tn6ChjrSH1ayFI6epZTDTDe2DqT6kpU X6dLTTCkgDQ== 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-dev] [PATCH] net/bnxt: fix memory leak when mapping failure 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" 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.