public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Joshua Hay <joshua.a.hay@intel.com>
Cc: <andrew+netdev@lunn.ch>, <davem@davemloft.net>,
	<edumazet@google.com>, <pabeni@redhat.com>,
	<netdev@vger.kernel.org>, <emil.s.tantilov@intel.com>,
	<stable@vger.kernel.org>, <aleksandr.loktionov@intel.com>,
	<patryk.holda@intel.com>
Subject: Re: [PATCH net v2 11/12] idpf: fix xdp crash in soft reset error path
Date: Mon, 20 Apr 2026 12:48:02 -0700	[thread overview]
Message-ID: <1edbd9e7-19ad-4cde-9567-ea46f9026c38@intel.com> (raw)
In-Reply-To: <20260418190019.194263-2-kuba@kernel.org>

Here's the full review on the website if it helps:

https://sashiko.dev/#/patchset/20260319224159.23885-1-emil.s.tantilov%40intel.com

Thanks,
Jake

On 4/18/2026 12:00 PM, Jakub Kicinski wrote:
> This is an AI-generated review of your patch. The human sending this
> email has considered the AI review valid, or at least plausible.
> 
> Jakub: I'll drop this patch and apply the rest.
> ---
> idpf: fix xdp crash in soft reset error path
> 
> This commit fixes a NULL pointer dereference in idpf_vport_open() when
> soft reset fails by restoring vport->xdp_prog to the old value. It also
> updates the restart check to use IDPF_VPORT_UP instead of netif_running().
> 
> Cc: stable@vger.kernel.org
> 
>> diff --git a/drivers/net/ethernet/intel/idpf/xdp.c b/drivers/net/ethernet/intel/idpf/xdp.c
>> --- a/drivers/net/ethernet/intel/idpf/xdp.c
>> +++ b/drivers/net/ethernet/intel/idpf/xdp.c
>> @@ -488,6 +488,7 @@ static int idpf_xdp_setup_prog(struct idpf_vport *vport,
>>  				   "Could not reopen the vport after XDP setup");
>>  
>>  		cfg->user_config.xdp_prog = old;
>> +		vport->xdp_prog = old;
> 
> Does this also need to roll back vport->num_xdp_txq?
> 
> Because idpf_initiate_soft_reset() overwrites the vport struct with the new
> queue configuration before failing, vport->num_xdp_txq might remain > 0
> while vport->xdp_prog is restored to NULL.
> 
> When the interface is brought up, idpf_xdpsqs_get() evaluates
> idpf_xdp_enabled(vport) as false and returns early without allocating the
> NAPI timers (xdpsq->timer).
> 
> Could another interface redirect XDP frames via ndo_xdp_xmit, bypassing the
> check because vport->num_xdp_txq > 0, and cause a NULL pointer dereference
> in libeth_xdpsq_queue_timer() during idpf_xdp_tx_finalize()?
> 
>>  		old = prog;
>>  	}
> 
> Is this old = prog assignment leading to a double-put of the BPF program?
> 
> If idpf_initiate_soft_reset() fails, this error path drops a reference to
> the newly provided prog when it calls bpf_prog_put(old) right after this
> block.
> 
> Since the function returns an error code to the core network stack, won't
> dev_xdp_install() in net/core/dev.c also explicitly call bpf_prog_put(prog)
> assuming ownership of the error cleanup?
> 
> Could this underflow the reference count and cause a use-after-free?
> 
> [ ... ]
> 
>> diff --git a/drivers/net/ethernet/intel/idpf/xsk.c b/drivers/net/ethernet/intel/idpf/xsk.c
>> --- a/drivers/net/ethernet/intel/idpf/xsk.c
>> +++ b/drivers/net/ethernet/intel/idpf/xsk.c
>> @@ -568,7 +569,8 @@ int idpf_xsk_pool_setup(struct idpf_vport *vport, struct netdev_bpf *bpf)
>>  		return -EINVAL;
>>  	}
>>  
>> -	restart = idpf_xdp_enabled(vport) && netif_running(vport->netdev);
>> +	restart = idpf_xdp_enabled(vport) &&
>> +		  test_bit(IDPF_VPORT_UP, np->state);
>>  	if (!restart)
>>  		goto pool;
> 
> Does this function leave the queue pair permanently disabled if the pool
> setup fails?
> 
> If restart is true, the queue pair is disabled via:
>     idpf_qp_switch(vport, qid, false);
> 
> If the subsequent call to libeth_xsk_setup_pool() fails, the function
> returns early:
> 
>     ret = libeth_xsk_setup_pool(vport->netdev, qid, pool);
>     if (ret) {
>         ...
>         return ret;
>     }
> 
> Does this early return bypass the idpf_qp_switch(vport, qid, true) call
> expected later, causing a permanent partial loss of connectivity until the
> interface is manually restarted?


  parent reply	other threads:[~2026-04-20 19:48 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-17  0:53 [PATCH net v2 00/12] Intel Wired LAN Driver Updates 2026-04-14 (ice, i40e, iavf, idpf, e1000e) Jacob Keller
2026-04-17  0:53 ` [PATCH net v2 01/12] ice: fix 'adjust' timer programming for E830 devices Jacob Keller
2026-04-17  0:53 ` [PATCH net v2 02/12] ice: update PCS latency settings for E825 10G/25Gb modes Jacob Keller
2026-04-17  0:53 ` [PATCH net v2 03/12] ice: fix double free in ice_sf_eth_activate() error path Jacob Keller
2026-04-17  0:53 ` [PATCH net v2 04/12] ice: fix double-free of tx_buf skb Jacob Keller
2026-04-17  0:53 ` [PATCH net v2 05/12] ice: fix PHY config on media change with link-down-on-close Jacob Keller
2026-04-17  0:53 ` [PATCH net v2 06/12] ice: fix ICE_AQ_LINK_SPEED_M for 200G Jacob Keller
2026-04-17  0:53 ` [PATCH net v2 07/12] ice: fix race condition in TX timestamp ring cleanup Jacob Keller
2026-04-17  0:53 ` [PATCH net v2 08/12] ice: fix potential NULL pointer deref in error path of ice_set_ringparam() Jacob Keller
2026-04-17  0:53 ` [PATCH net v2 09/12] i40e: don't advertise IFF_SUPP_NOFCS Jacob Keller
2026-04-17  0:53 ` [PATCH net v2 10/12] iavf: fix wrong VLAN mask for legacy Rx descriptors L2TAG2 Jacob Keller
2026-04-17  0:53 ` [PATCH net v2 11/12] idpf: fix xdp crash in soft reset error path Jacob Keller
2026-04-18 19:00   ` Jakub Kicinski
2026-04-20 19:41     ` Jacob Keller
2026-04-20 19:48     ` Jacob Keller [this message]
2026-04-17  0:53 ` [PATCH net v2 12/12] e1000e: Unroll PTP in probe error handling Jacob Keller
2026-04-18 19:10 ` [PATCH net v2 00/12] Intel Wired LAN Driver Updates 2026-04-14 (ice, i40e, iavf, idpf, e1000e) patchwork-bot+netdevbpf

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=1edbd9e7-19ad-4cde-9567-ea46f9026c38@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=aleksandr.loktionov@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=emil.s.tantilov@intel.com \
    --cc=joshua.a.hay@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=patryk.holda@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