public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Kohei Enju <kohei@enjuk.jp>
To: kohei@enjuk.jp
Cc: andrew+netdev@lunn.ch, anthony.l.nguyen@intel.com,
	bjorn@kernel.org, daniel@iogearbox.net, davem@davemloft.net,
	edumazet@google.com, intel-wired-lan@lists.osuosl.org,
	kuba@kernel.org, lihaoxiang@isrc.iscas.ac.cn,
	linux-kernel@vger.kernel.org, magnus.karlsson@intel.com,
	netdev@vger.kernel.org, pabeni@redhat.com,
	przemyslaw.kitszel@intel.com, stable@vger.kernel.org
Subject: Re: [Intel-wired-lan] [PATCH v2] i40e: add an error handling path in
Date: Sat, 31 Jan 2026 07:02:38 +0000	[thread overview]
Message-ID: <20260131070335.38303-1-kohei@enjuk.jp> (raw)
In-Reply-To: <20260131061304.27368-1-kohei@enjuk.jp>

On Sat, 31 Jan 2026 06:12:12 +0000, Kohei Enju wrote:

> On Sat, 31 Jan 2026 13:52:17 +0800, Haoxiang Li wrote:
> 
> > In i40e_xsk_pool_enable(), add an error handling path to
> > prevent potential memory leaks.
> > 
> > Fixes: 1742b3d52869 ("xsk: i40e: ice: ixgbe: mlx5: Pass buffer pool to driver instead of umem")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
> > ---
> > Changes in v2:
> > - Add a Fixes tag. Thanks, Paul!
> > - Replace unmap with i40e_xsk_pool_disable() to prevent
> > a limbo state of queues. Thanks, Maciej! 
> > ---
> >  drivers/net/ethernet/intel/i40e/i40e_xsk.c | 11 +++++++----
> >  1 file changed, 7 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..a72a309540c3 100644
> > --- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> > +++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> > @@ -108,23 +108,26 @@ 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 err_out;
> >  
> >  		err = i40e_realloc_rx_xdp_bi(vsi->rx_rings[qid], true);
> >  		if (err)
> > -			return err;
> > +			goto err_out;
> >  
> >  		err = i40e_queue_pair_enable(vsi, qid);
> >  		if (err)
> > -			return err;
> > +			goto err_out;
> >  
> >  		/* 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 err_out;
> >  	}
> >  
> >  	return 0;
> > +
> > +err_out:
> > +	i40e_xsk_pool_disable(vsi, qid);
> 
> I think return err; is missing...
> 
> Also, since i40e_xsk_pool_disable is not declared before this line,
> compilation fails due to a 'Call to undeclared function
> i40e_xsk_pool_disable' error. Adding declaration or moving
> i40e_xsk_pool_enable() after i40e_xsk_pool_disable() is needed.

After skimming the code, I think i40e_xsk_pool_disable() can fail in
this error path, right? 

Let's assume a scenario that i40e_queue_pair_disable() succeeds but
i40e_realloc_rx_xdp_bi() fails in i40e_xsk_pool_enable(). 
At this point, i40e_enter_busy_conf() called by
i40e_queue_pair_disable() has set __I40E_CONFIG_BUSY state.

Then the err_out: path is executed and i40e_xsk_pool_disable() tries to
call i40e_queue_pair_disable() when if_running.
In this case, i40e_enter_busy_conf() fails because __I40E_CONFIG_BUSY is
set, and finally xsk_pool_dma_unmap() isn't called.

Do you have any thoughts on how to handle this case?

Thanks.

> 
> >  }
> >  
> >  /**
> > -- 
> > 2.25.1

  reply	other threads:[~2026-01-31  7:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-31  5:52 [PATCH v2] i40e: add an error handling path in i40e_xsk_pool_enable() Haoxiang Li
2026-01-31  6:12 ` [Intel-wired-lan] [PATCH v2] i40e: add an error handling path in Kohei Enju
2026-01-31  7:02   ` Kohei Enju [this message]
2026-01-31 15:44 ` [Intel-wired-lan] [PATCH v2] i40e: add an error handling path in i40e_xsk_pool_enable() kernel test robot
2026-01-31 15:50 ` kernel test robot
2026-01-31 16:33 ` kernel test robot
2026-02-01  5:44 ` kernel test robot

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=20260131070335.38303-1-kohei@enjuk.jp \
    --to=kohei@enjuk.jp \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=bjorn@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=kuba@kernel.org \
    --cc=lihaoxiang@isrc.iscas.ac.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=stable@vger.kernel.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