From: Qiming Chen <chenqiming_huawei@163.com>
To: dev@dpdk.org
Cc: beilei.xing@intel.com, jingjing.wu@intel.com,
Qiming Chen <chenqiming_huawei@163.com>,
stable@dpdk.org
Subject: [dpdk-dev] [PATCH] net/iavf: fix rx queue irqs resource leak
Date: Fri, 10 Sep 2021 14:54:57 +0800 [thread overview]
Message-ID: <20210910065457.12113-1-chenqiming_huawei@163.com> (raw)
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 <chenqiming_huawei@163.com>
---
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
next reply other threads:[~2021-09-10 6:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-10 6:54 Qiming Chen [this message]
2021-09-27 7:06 ` Zhang, Qi Z
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210910065457.12113-1-chenqiming_huawei@163.com \
--to=chenqiming_huawei@163.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=jingjing.wu@intel.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).