From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 99542A0547; Fri, 10 Sep 2021 08:56:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 84EF4406B4; Fri, 10 Sep 2021 08:56:00 +0200 (CEST) Received: from mail-m971.mail.163.com (mail-m971.mail.163.com [123.126.97.1]) by mails.dpdk.org (Postfix) with ESMTP id 178A74003E; Fri, 10 Sep 2021 08:55:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=MyGJb qEKbg0e7K1xrrTGOTQxX7X/BwmIb1pFjPkIwxw=; b=hagE1+oFUdj0q8bza5aVn 7dHAkVKrFjVhavSXdxqCPvlNLeQDAyfMbtEzUSHQ21W/69+hr0VxkrviH4m+/C4P CHILFalrCBJeQk/rLK1Syp5C4pokSYphBIrpz/KCSgs8MmyHd59Mll5TWq7Vf4Dr Vy0NjJPafHI7L9/mg5TWDY= Received: from localhost.localdomain (unknown [124.160.213.250]) by smtp1 (Coremail) with SMTP id GdxpCgAH2oRrATthZl3hAw--.5918S2; Fri, 10 Sep 2021 14:55:41 +0800 (CST) From: Qiming Chen To: dev@dpdk.org Cc: beilei.xing@intel.com, jingjing.wu@intel.com, Qiming Chen , stable@dpdk.org Date: Fri, 10 Sep 2021 14:54:57 +0800 Message-Id: <20210910065457.12113-1-chenqiming_huawei@163.com> X-Mailer: git-send-email 2.30.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: GdxpCgAH2oRrATthZl3hAw--.5918S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7Ww4xGr47JrW5WFykXFW5Wrg_yoW8uw1kpF Z8KFn3AFy8JFZIgay3Kay8Wrnxuws7tFyxCF47Kasxu34Ykry8Zr95CasFqF1ktFWkAa12 qr4rKayvgFZ8tFDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j7Xo7UUUUU= X-Originating-IP: [124.160.213.250] X-CM-SenderInfo: xfkh01xlpl0w5bkxt4lhl6il2tof0z/xtbBzwoKoFaEAIuMswACsL Subject: [dpdk-dev] [PATCH] net/iavf: fix rx queue irqs resource leak X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" In the iavf_config_rx_queues_irqs function, the memory pointed to by the intr_handle->intr_vec and qv_map addresses is not released in the subsequent hook branch, resulting in resource leakage. Fixes: f593944fc988 ("net/iavf: enable IRQ mapping configuration for large VF") Cc: stable@dpdk.org Signed-off-by: Qiming Chen --- drivers/net/iavf/iavf_ethdev.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 574cfe055e..280d53a651 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -674,7 +674,7 @@ static int iavf_config_rx_queues_irqs(struct rte_eth_dev *dev, if (!qv_map) { PMD_DRV_LOG(ERR, "Failed to allocate %d queue-vector map", dev->data->nb_rx_queues); - return -1; + goto qv_map_alloc_err; } if (!dev->data->dev_conf.intr_conf.rxq || @@ -759,7 +759,7 @@ static int iavf_config_rx_queues_irqs(struct rte_eth_dev *dev, if (!vf->lv_enabled) { if (iavf_config_irq_map(adapter)) { PMD_DRV_LOG(ERR, "config interrupt mapping failed"); - return -1; + goto config_irq_map_err; } } else { uint16_t num_qv_maps = dev->data->nb_rx_queues; @@ -769,7 +769,7 @@ static int iavf_config_rx_queues_irqs(struct rte_eth_dev *dev, if (iavf_config_irq_map_lv(adapter, IAVF_IRQ_MAP_NUM_PER_BUF, index)) { PMD_DRV_LOG(ERR, "config interrupt mapping for large VF failed"); - return -1; + goto config_irq_map_err; } num_qv_maps -= IAVF_IRQ_MAP_NUM_PER_BUF; index += IAVF_IRQ_MAP_NUM_PER_BUF; @@ -777,10 +777,20 @@ static int iavf_config_rx_queues_irqs(struct rte_eth_dev *dev, if (iavf_config_irq_map_lv(adapter, num_qv_maps, index)) { PMD_DRV_LOG(ERR, "config interrupt mapping for large VF failed"); - return -1; + goto config_irq_map_err; } } return 0; + +config_irq_map_err: + rte_free(vf->qv_map); + vf->qv_map = NULL; + +qv_map_alloc_err: + rte_free(intr_handle->intr_vec); + intr_handle->intr_vec = NULL; + + return -1; } static int -- 2.30.1.windows.1