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

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Tue Apr 7 19:15:29 CEST 2026


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

_AI Code Review_

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

Reviewing patch 'series.patch':

git sha: FEA1D5B98F367DFC+20260407021428.620-1-ouyanghao at tencent.com
Author: Ouyang Hao <ouyanghao at tencent.com>
Subject: [PATCH] net/af_xdp: fix resource leak in eth_dev_close

The commit fixes a resource leak where per-queue cleanup incorrectly
freed individual elements of contiguously allocated queue arrays,
preventing proper cleanup of queues beyond the first.

> 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);

Does the removal of rte_free(rxq->pair) cause a leak? The commit message
states that rx_queues and tx_queues are contiguously allocated, but does
not mention rxq->pair. If rxq->pair is individually allocated per queue
(which seems likely given the original per-element free), then removing
this call without replacement would leak those allocations.

Can you verify whether rxq->pair is part of the contiguous allocation or
separately allocated? If separately allocated, should it be freed in a
separate loop before freeing the queue arrays?

>  	/*
>  	 * MAC is not allocated dynamically, setting it to NULL would prevent
>  	 * from releasing it in rte_eth_dev_release_port.


More information about the test-report mailing list