All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Antonio Quartulli" <antonio@mandelbit.com>,
	intel-wired-lan@lists.osuosl.org
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net v3 1/4] igb: don't disable rings that don't exist when disabling an XSK pool
Date: Fri, 20 Nov 2026 14:04:34 +0000	[thread overview]
Message-ID: <sashiko-outbox-225316@kernel.org> (raw)
In-Reply-To: <20261119140412.163202-2-antonio@mandelbit.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] igb: missing num_tx_queues check in igb_xsk_pool_disable()
  dereferences NULL
--

commit e4f6db572e101ec4f5da6fee01a7451218673315
Author: Antonio Quartulli <antonio@mandelbit.com>

igb: don't disable rings that don't exist when disabling an XSK pool

This commit checks qid against adapter->num_rx_queues in
igb_xsk_pool_disable() so rings that do not exist are not disabled or
re-enabled.

Link: https://lore.kernel.org/netdev/20261116153041.3002666-2-antonio@mandelbit.com/

> diff --git a/drivers/net/ethernet/intel/igb/igb_xsk.c b/drivers/net/ethernet/intel/igb/igb_xsk.c
> index ce4a7b58cad2f..8ed82bb1def9a 100644
> --- a/drivers/net/ethernet/intel/igb/igb_xsk.c
> +++ b/drivers/net/ethernet/intel/igb/igb_xsk.c
> @@ -148,7 +148,12 @@ static int igb_xsk_pool_disable(struct igb_adapter *adapter, u16 qid)
>  		return -EINVAL;
>  
>  	rx_ring = adapter->rx_ring[qid];
> -	if_running = netif_running(adapter->netdev) && igb_xdp_is_enabled(adapter);
> +	/* The stack can know more queues than the device has, e.g. after a
> +	 * fallback to fewer queues on resume: skip the rings it doesn't have.
> +	 */
> +	if_running = netif_running(adapter->netdev) &&
> +		     igb_xdp_is_enabled(adapter) &&
> +		     qid < adapter->num_rx_queues;
>  	if (if_running)
>  		igb_txrx_ring_disable(adapter, qid);

[Severity: Medium]
Can igb_txrx_ring_disable() still dereference a NULL adapter->tx_ring[qid]
when qid >= adapter->num_tx_queues?

In igb_set_interrupt_capability(), allocating SR-IOV VFs forces
adapter->num_tx_queues to 1 while leaving adapter->num_rx_queues at
adapter->rss_queues (up to 2 on 82576):

drivers/net/ethernet/intel/igb/igb_main.c:igb_set_interrupt_capability() {
	...
	adapter->num_rx_queues = adapter->rss_queues;
	if (adapter->vfs_allocated_count)
		adapter->num_tx_queues = 1;
	else
		adapter->num_tx_queues = adapter->rss_queues;
	...
}

Because igb_xsk_pool_enable() also only checks qid >= adapter->num_rx_queues,
disabling a pool bound to qid 1 when SR-IOV is active passes qid <
adapter->num_rx_queues and reaches igb_txrx_ring_disable(), which
immediately dereferences adapter->tx_ring[1] (NULL).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119140412.163202-1-antonio@mandelbit.com?part=1

  reply	other threads:[~2026-11-20 14:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 14:04 [PATCH net v3 0/4] igb: fix runtime PM resume issues Antonio Quartulli
2026-11-19 14:04 ` [PATCH net v3 1/4] igb: don't disable rings that don't exist when disabling an XSK pool Antonio Quartulli
2026-11-20 14:04   ` sashiko-bot [this message]
2026-11-19 14:04 ` [PATCH net v3 2/4] igb: fix RTNL assertion when resuming from runtime suspend Antonio Quartulli
2026-11-19 14:04 ` [PATCH net v3 3/4] igb: link queues to NAPIs under RTNL after runtime resume Antonio Quartulli
2026-11-19 14:04 ` [PATCH net v3 4/4] igb: only allow runtime PM if the device can wake up Antonio Quartulli

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=sashiko-outbox-225316@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=antonio@mandelbit.com \
    --cc=bpf@vger.kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.