|SUCCESS| net/af_xdp: fix resource leak in eth_dev_close

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Tue Apr 7 20:38:41 CEST 2026


Test-Label: ai-code-review
Test-Status: SUCCESS
https://dpdk.org/patch/162885

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-04-07

Commit: F8BAB5327DFA4F53+20260403124053.1354-1-ouyanghao at tencent.com
Author: Ouyang Hao <ouyanghao at tencent.com>
Subject: [PATCH] net/af_xdp: fix resource leak in eth_dev_close

This patch addresses a resource leak in the AF_XDP PMD's device close
function by correcting the queue cleanup logic.

> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
> index 10dbcf1333..2cdb533276 100644
> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> @@ -1069,12 +1069,10 @@ eth_dev_close(struct rte_eth_dev *dev)
>  		if (rte_atomic_fetch_sub_explicit(&rxq->umem->refcnt, 1,
>  				rte_memory_order_acquire) - 1 == 0)
>  			xdp_umem_destroy(rxq->umem);
> -
> -		/* free pkt_tx_queue */
> -		rte_free(rxq->pair);
> -		rte_free(rxq);
>  	}
> -
> +	/* Free Tx and Rx queue arrays */
> +	rte_free(internals->tx_queues);
> +	rte_free(internals->rx_queues);

The patch correctly identifies that rx_queues and tx_queues are allocated
as contiguous blocks. However, does this change leak the rxq->pair
allocations? Looking at the original code, rxq->pair appears to be freed
separately, suggesting it may have been individually allocated.

Can you verify whether rxq->pair (the pkt_tx_queue) is allocated per-queue
or as part of the contiguous tx_queues block? If it's allocated separately
(perhaps in queue setup functions), removing rte_free(rxq->pair) would
create a memory leak.

Additionally, are there any dynamically allocated resources within
individual queue structures that need cleanup before freeing the arrays?
The code structure suggests rxq might contain more than just the UMEM
reference.


More information about the test-report mailing list