Subject: Re: [PATCH] i40e: add an error handling path in i40e_xsk_pool_enable()

From: Maciej Fijalkowski <[email-masked]>
Date: Mon, 26 Jan 2026 21:37:35 +0100

On Sun, Jan 25, 2026 at 10:04:23PM +0800, Haoxiang Li wrote:
> In i40e_xsk_pool_enable(), the memory allocated by
> xsk_pool_dma_map() should be released if some error
> occurs. Add an error handling path to do so.
> 
> Signed-off-by: Haoxiang Li <[email-masked]>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_xsk.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> index 9f47388eaba5..92b853a75b28 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> @@ -108,23 +108,27 @@ static int i40e_xsk_pool_enable(struct i40e_vsi *vsi,
>  	if (if_running) {
>  		err = i40e_queue_pair_disable(vsi, qid);
>  		if (err)
> -			return err;
> +			goto unmap;
>  
>  		err = i40e_realloc_rx_xdp_bi(vsi->rx_rings[qid], true);
>  		if (err)
> -			return err;
> +			goto unmap;
>  
>  		err = i40e_queue_pair_enable(vsi, qid);
>  		if (err)
> -			return err;
> +			goto unmap;
>  
>  		/* Kick start the NAPI context so that receiving will start */
>  		err = i40e_xsk_wakeup(vsi->netdev, qid, XDP_WAKEUP_RX);
>  		if (err)
> -			return err;
> +			goto unmap;
>  	}
>  
>  	return 0;
> +
> +unmap:
> +	xsk_pool_dma_unmap(pool, I40E_RX_DMA_ATTR);

Hi Haoxiang,

this will leave queues in a limbo state if you fail before qp enable.
It would be better to call i40e_xsk_pool_disable() which will do the dma
unmap internally.

> +	return err;
>  }
>  /**
> -- 
> 2.25.1