Skip to content

Commit

Permalink
net/iavf: fix Rx queue IRQ resource leak
Browse files Browse the repository at this point in the history
[ upstream commit ad5629d ]

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: f593944 ("net/iavf: enable IRQ mapping configuration for large VF")

Signed-off-by: Qiming Chen <chenqiming_huawei@163.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
  • Loading branch information
Qiming Chen authored and steevenlee committed Nov 8, 2021
1 parent cd90c7a commit eca9795
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions drivers/net/iavf/iavf_ethdev.c
Expand Up @@ -509,7 +509,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 ||
Expand Down Expand Up @@ -594,7 +594,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;
Expand All @@ -604,18 +604,28 @@ 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;
}

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
Expand Down

0 comments on commit eca9795

Please sign in to comment.