From: sashiko-bot@kernel.org
To: "Antonio Quartulli" <antonio@mandelbit.com>,
intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH net v2 1/3] igb: fix RTNL assertion when resuming from runtime suspend
Date: Tue, 17 Nov 2026 15:31:06 +0000 [thread overview]
Message-ID: <sashiko-outbox-219079@kernel.org> (raw)
In-Reply-To: <20261116153041.3002666-2-antonio@mandelbit.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] igb: stale real queue counts after resume MSI fallback in
__igb_open()
--
commit 6c8e67bb8e01233489112f0bf629f1764d87d2c6
Author: Antonio Quartulli <antonio@mandelbit.com>
igb: fix RTNL assertion when resuming from runtime suspend
This commit skips calling netif_set_real_num_tx_queues() and
netif_set_real_num_rx_queues() in __igb_open() when resuming is true to
avoid triggering an RTNL assertion during runtime resume.
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index 131df3e09ba14..bf8acac72b324 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -4178,16 +4178,20 @@ static int __igb_open(struct net_device *netdev, bool resuming)
> if (err)
> goto err_req_irq;
>
> - /* Notify the stack of the actual queue counts. */
> - err = netif_set_real_num_tx_queues(adapter->netdev,
> - adapter->num_tx_queues);
> - if (err)
> - goto err_set_queues;
> + /* Notify the stack of the actual queue counts. This needs RTNL,
> + * which isn't held when resuming from runtime suspend.
> + */
> + if (!resuming) {
> + err = netif_set_real_num_tx_queues(adapter->netdev,
> + adapter->num_tx_queues);
> + if (err)
> + goto err_set_queues;
>
> - err = netif_set_real_num_rx_queues(adapter->netdev,
> - adapter->num_rx_queues);
> - if (err)
> - goto err_set_queues;
> + err = netif_set_real_num_rx_queues(adapter->netdev,
> + adapter->num_rx_queues);
> + if (err)
> + goto err_set_queues;
> + }
>
> /* From here on the code is the same as igb_up() */
> clear_bit(__IGB_DOWN, &adapter->state);
[Severity: Medium]
Can leaving netdev->real_num_tx_queues and netdev->real_num_rx_queues stale
when MSI-X falls back to MSI during resume cause concurrent unlocked TX on
adapter->tx_ring[0] and a NULL pointer dereference in igb_xsk_pool_disable()?
During suspend, __igb_shutdown() -> igb_clear_interrupt_scheme() frees all
q_vectors and clears adapter->tx_ring[] and adapter->rx_ring[]. If MSI-X
allocation fails on resume (including system resume via igb_resume() ->
__igb_resume(dev, false), which already holds rtnl_lock() but still passes
resuming = true), the driver falls back to MSI with adapter->num_tx_queues
and adapter->num_rx_queues set to 1, allocating only index 0 while
netdev->real_num_tx_queues and netdev->real_num_rx_queues remain at N > 1.
In the TX path, the stack selects subqueues across 0 .. real_num_tx_queues - 1,
each serialized only by its own netdev->_tx[q]._xmit_lock, but
igb_tx_queue_mapping() folds all of them onto adapter->tx_ring[0]:
drivers/net/ethernet/intel/igb/igb_main.c:igb_tx_queue_mapping() {
unsigned int r_idx = skb->queue_mapping;
if (r_idx >= adapter->num_tx_queues)
r_idx = r_idx % adapter->num_tx_queues;
return adapter->tx_ring[r_idx];
}
CPU0 (subqueue 0) CPU1 (subqueue 1)
netdev_start_xmit() netdev_start_xmit()
HARD_TX_LOCK(dev, txq0) HARD_TX_LOCK(dev, txq1)
igb_xmit_frame() igb_xmit_frame()
igb_tx_queue_mapping() igb_tx_queue_mapping()
-> adapter->tx_ring[0] -> adapter->tx_ring[0]
igb_xmit_frame_ring(tx_ring[0]) igb_xmit_frame_ring(tx_ring[0])
first = &tx_ring-> first = &tx_ring->
tx_buffer_info[next_to_use] tx_buffer_info[next_to_use]
<-- concurrent ring corruption
Multiple CPUs transmitting on different subqueues concurrently run
igb_xmit_frame_ring() and igb_tx_map() on adapter->tx_ring[0], corrupting
tx_ring->next_to_use, tx_buffer_info, hardware descriptors, and BQL state.
In addition, igb_xsk_pool_disable() checks xsk_get_pool_from_qid(), which
validates qid against real_num_rx_queues and real_num_tx_queues; disabling an
AF_XDP pool bound to qid >= 1 after a resume fallback passes qid to
igb_txrx_ring_disable(), dereferencing NULL adapter->tx_ring[qid] and
adapter->rx_ring[qid].
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116153041.3002666-1-antonio@mandelbit.com?part=1
next prev parent reply other threads:[~2026-11-17 15:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 15:30 [PATCH net v2 0/3] igb: fix runtime PM resume issues Antonio Quartulli
2026-11-16 15:30 ` [PATCH net v2 1/3] igb: fix RTNL assertion when resuming from runtime suspend Antonio Quartulli
2026-11-17 15:31 ` sashiko-bot [this message]
2026-11-16 15:30 ` [PATCH net v2 2/3] igb: link queues to NAPIs under RTNL after runtime resume Antonio Quartulli
2026-11-16 15:30 ` [PATCH net v2 3/3] 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-219079@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=antonio@mandelbit.com \
--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.