🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26077

Re: [PATCH net v7 3/7] igb: fix RTNL assertion when resuming from runtime suspend

#26077
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 01:04
216 lines
15680 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 (2) · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The patch does not fully fix the RTNL assertion it targets on
  runtime resume, but a later patch in the series closes the gap.

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but
  `igb_save_cbs_params()` and `igb_save_txtime_params()` have an off-by-…
- [High] This problem wasn't introduced by this patch, but the MSI-X to
  MSI fallback in `igb_request_irq()` frees Rx/Tx descriptor rings and…

--

igb: fix RTNL assertion when resuming from runtime suspend

On runtime resume, __igb_open() no longer calls netif_set_real_num_queues()
when RTNL isn't held. A new work item takes RTNL and sets the queue
counts instead. Until that runs, igb_xmit_frame() drops packets whose
queue_mapping is beyond the device's current TX queue count, rather than
folding them onto a shared ring.

Closes: https://bugzilla.ipfire.org/show_bug.cgi?id=13562

> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index 2fb9615d3bab3..5774a4d3c9810 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c

[ ... ]

> @@ -4181,16 +4209,15 @@ static int __igb_open(struct net_device *netdev, bool resuming)
>  	if (err)
>  		goto err_req_irq;
>  

[Severity: High]

This isn't a bug introduced by this patch, but the commit message relies
on the MSI-X to MSI fallback in igb_request_irq(). Is that fallback safe
for the hardware queues that igb_configure() has already enabled?

__igb_open() calls igb_configure() before igb_request_irq(). For each of
the N queues:

- igb_configure_rx_ring() enables RXDCTL and programs the ring base.
- igb_alloc_rx_buffers() advances RDT.
- igb_setup_rctl() sets E1000_RCTL_EN.
- igb_setup_mrqc() spreads RSS over all N queues.

If igb_request_msix() fails:

drivers/net/ethernet/intel/igb/igb_main.c:igb_request_irq() {
    ...
		/* fall back to MSI */
		igb_free_all_tx_resources(adapter);
		igb_free_all_rx_resources(adapter);

		igb_clear_interrupt_scheme(adapter);
		err = igb_init_interrupt_scheme(adapter, false);
    ...
		igb_configure(adapter);
    ...
}

The descriptor rings and Rx pages are freed without any RXDCTL/TXDCTL
write. The second igb_configure() only reconfigures the new, smaller set
of queues. igb_setup_rctl() only disables queue 0:

	/* disable queue 0 to prevent tail write w/o re-config */
	wr32(E1000_RXDCTL(0), 0);

Can queues 1..N-1 stay enabled, with base addresses and posted
descriptors that point at freed memory?

Packets could still be steered there in two ways:

- RSS, until the second igb_setup_mrqc() rewrites RETA.
- ntuple/etype filters with an action queue >= 1, permanently.
  igb_nfc_filter_restore() re-adds them without checking them against the
  new num_rx_queues. The only check is in igb_add_ethtool_nfc_entry().

Would the NIC then DMA packet data and descriptor write-backs into freed
pages?

> -	/* 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;
> -
> -	err = netif_set_real_num_rx_queues(adapter->netdev,
> -					   adapter->num_rx_queues);
> -	if (err)
> -		goto err_set_queues;
> +	/* Notify the stack of the actual queue counts. This needs RTNL: on
> +	 * runtime resume igb_rtnl_resume_task() does it.
> +	 */
> +	if (rtnl_held) {
> +		err = netif_set_real_num_queues(netdev, adapter->num_tx_queues,
> +						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]

Does this fully cover the RTNL assertion on runtime resume? A few lines
further down in __igb_open(), the NAPI loop isn't guarded by rtnl_held:

	for (i = 0; i < adapter->num_q_vectors; i++) {
		napi = &adapter->q_vector[i]->napi;
		napi_enable(napi);
		igb_set_queue_napi(adapter, i, napi);
	}

igb_set_queue_napi() calls netif_queue_set_napi(), which runs
netdev_assert_locked_ops_compat_or_invisible(). igb is a registered
netdev without the ops lock, so this becomes ASSERT_RTNL(). The runtime
resume path is:

igb_runtime_resume()
  __igb_resume(dev, true)
    __igb_open(netdev, true, false)
      igb_set_queue_napi()
        netif_queue_set_napi()

Wouldn't this still print "RTNL: assertion failed" and write
rxq->napi/txq->napi without RTNL? igb_rtnl_resume_task() only restores
the queue counts, not the links between queues and NAPIs.

The later patch in this series, "igb: link queues to NAPIs under RTNL
after runtime resume", appears to fix this. It guards
igb_set_queue_napi() with rtnl_held and calls igb_link_queue_napis() from
igb_rtnl_resume_task(). So the gap only exists between these two commits.
Since this patch carries the Fixes: and stable tags, should the two be
combined?

[ ... ]

> @@ -6638,6 +6660,17 @@ static netdev_tx_t igb_xmit_frame(struct sk_buff *skb,
>  	if (skb_put_padto(skb, 17))
>  		return NETDEV_TX_OK;
>  
> +	/* After a fallback to fewer queues on runtime resume, the stack can
> +	 * use more queues than the device has until igb_rtnl_resume_task()
> +	 * updates it: drop those packets instead of sharing a ring between
> +	 * queues, which aren't serialized with each other.
> +	 */
> +	if (unlikely(skb->queue_mapping >= adapter->num_tx_queues)) {
> +		dev_kfree_skb_any(skb);
> +		dev_core_stats_tx_dropped_inc(netdev);
> +		return NETDEV_TX_OK;
> +	}

[Severity: High]

This isn't a bug introduced by this patch, but this check uses >=, while
igb_save_cbs_params() and igb_save_txtime_params() use >:

drivers/net/ethernet/intel/igb/igb_main.c:igb_save_cbs_params() {
    ...
	if (queue < 0 || queue > adapter->num_tx_queues)
		return -EINVAL;

	ring = adapter->tx_ring[queue];

	ring->cbs_enable = enable;
    ...
}

igb_save_txtime_params() has the same check before:

	ring->launchtime_enable = enable;

On i210, igb_offload_cbs() and igb_offload_txtime() accept queue 0 or 1,
whatever num_tx_queues is:

	if (qopt->queue < 0 || qopt->queue > 1)
		return -EINVAL;

num_tx_queues can be 1 in these cases:

- a single online CPU
- after ethtool -L combined 1
- after the MSI-X to MSI fallback discussed in this commit

In that case, can queue 1 pass both checks and dereference a NULL
tx_ring[1]? That entry is either never assigned or set to NULL by
igb_reset_q_vector().

The netdev has 8 allocated TX queues, and mq_queue_get() only rejects
ntx >= dev->num_tx_queues. So these commands reach igb_setup_tc() with
queue 1:

  tc qdisc add dev X root handle 1: mq
  tc qdisc replace dev X parent 1:2 cbs ... offload 1

An etf qdisc with offload takes the same path.

Should both helpers check queue >= adapter->num_tx_queues instead?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202002317.3140591-1-antonio%40mandelbit.com
Technical Details
Message-ID: <179625985176.3146.14979962176226526203@kernel.org>
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer04.iad!feed-me.highwinds-media.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376187-linux-kernel-netdev=dewy.ru
References: <20261202002317.3140591-4-antonio@mandelbit.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer04.iad!feed-me.highwinds-media.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376187-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v7 3/7] igb: fix RTNL assertion when resuming from runtime suspend
Date: Thu, 03 Dec 2026 01:04:11 +0000
Organization: Usenet Network
Message-ID: <179625985176.3146.14979962176226526203@kernel.org>
References: <20261202002317.3140591-4-antonio@mandelbit.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="2101553"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:sdLu2o1hW+FVV0EtiFcMFLcRwr4= sha256:y+qU1jyeq8GNTMBhdEBkFZBcJQBzQUpX8bD/liQzXB4= sha1:u6uK8ruDuiCFBgXRr5SvUEyE030= sha256:OE5Qklr5dBNpML0W7LE2W0hht6vEauyjmlWsAIOMpd0=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 8FDED1177D0; Thu,  3 Dec 2026 04:04:36 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PA099YCIosE4; Thu,  3 Dec 2026 04:04:28 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-376187-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 671961177CB; Thu,  3 Dec 2026 04:04:19 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 57B70242A0; Thu,  3 Dec 2026 01:04:16 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796259855; b=m1OWeVLKKIc2IIoLLHUuo+pxL5Zyu9hV2Qh1ALD4O2XE21JIcGeZdXjavLIjBfUYSo30 9bURbPbLA7ZeOmSlp+C5S0Kh/B0G9IkyHbL3EMFuiKp8/YtQQ70IRnc/dYmv4gZUmogWm aJ1KPTGmIL6zuF/rrxZ+cIKrPpzGjs5zK0jiF6/fY1OWT5GnVGDn07/ia3HjFLOL/BT8K /YdFm57kp9z0XfGAcMOg9BcvQaWC5NXJlhCsZZHaY4ummRv/1dskmdsZvoGPNIAoKOp7i AXW82AE9UO0HCvMiL8CpS+FkKz/ry8IkosGdY7HyRSfZcoWpUHilFdM0it0CaoQMXCg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796259855; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=30+1M6rYJW4y5xhkVZrEXqppID9NGQm6ceEBKZdPb3E=; b=kU9XJI+ZLQbsYxbNoTKTswRtb/s4teIW1fBG+sPjVywK6NLIMz0sc6m/Bjz3E4WN57uj HJEsgr7XaNuMqkGImAih5jMClZk/bEX85PSrkPGBdn3wYhL8wEQVj1Ap8bpyYERpJwvxU O1WgQUoAr2Rgn4r629N1DB1UpXxokRxK72EL9j+dqx3J306xiYVUKCj74bSlBL2qvxVgr zsyxvRGNs4LJLhUoM234gsjsZwE2weqydJ4xDHC90KfAn+JFBT53DPDQ4Puh80s9MKe0r SYZkDlY7Vymu/y3Ez4aodj6ZJfA2Oo/vR/HKpn1+NuZIMDjS0wcI0GlfevuaKMXCgbw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="hv1hu/3I"; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 36CA8606A68E; Thu,  3 Dec 2026 01:04:15 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hv1hu/3I
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796259854; b=rr1rtsuWRDpZC3rbyQjVSEK3/aE4POmdoT3gKVW0Napd9MRKtbt7CAW2ScRbPsVCx7bt +NxllvGUC3VdpoWuMat5HgQGuAdyRaGpafffjx9bZ1UkG/RzRYqLw2pzDFSUdXk4nOEFO 0SBp8QSt2NHkkYQ4qHk01pQwzPf9tvE/wKQc6SQaU+whYEx5JxV7DtKkQ67vLL1MFl12U 2gOdDOArus6yYP+/5ChHUO18q41u9AM9VC5hqrQPDSxgs8mK9Piyc1bdA9WqiNFl87fjt tym/2oU83IY0UQWfBkNLZ8StnjnX6/i7SUAt7i6oxpsI0V+6IRM766gTG4/TxT9iWJA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796259854; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=30+1M6rYJW4y5xhkVZrEXqppID9NGQm6ceEBKZdPb3E=; b=4q3u3ktlVoW5lQtxxdeDiKRJ5MO1A84gJ01AhpmJNoV6fuAZ+0a+71u1EvUr00XBocXH RSeTqB4GL/DXbAEaO0T/FGL8+nKiCelQ6tEKRnZ0bONOxvJD6TOgPGJdy28KwJAnTlUr/ jfUYfUTAWUAbugB4qG5NRimex5N5RGLpE2q4WlfDU0xOZXEb7c7UVk6pD0aMHKdaY2dtL c0DDnZfBtNO+sG6WoOh0z2uJEVLZFPJY2DiN3M54R/HKVSVEo9dHhCueMHKHlJM5yDCxY /vEBojAIISxh5OzI/6JMtJXoZ2tbITfE46EbsUI+VSaILFZfQcy+hi8bDYKnxol8OUg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="hv1hu/3I"; arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5161B606A33E; Thu,  3 Dec 2026 01:04:13 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C9721F00893; Thu,  3 Dec 2026 01:04:12 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796259853; bh=30+1M6rYJW4y5xhkVZrEXqppID9NGQm6ceEBKZdPb3E=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=hv1hu/3IQ/DJGwwMJgOFWNky97a6c7Zw0ta6biNVEIEyWnH5zWEu7EFZmCjuVaJ0e WdBQkhe9Hrvsaf3vCTK7xF5jIblJWBAjYdUJW9MHfKjwhHL+fd1Mpmkdwi4/vCVOX/ rqM5eaXBe2/4J/MLA4KhLMMLa1B0cJgug00i4wUpxuRH/9TmWZaUQuGdLkPC1wJSY+ /V2hHqFlaxrIyvVuqlrrzjRkbYrhWRTeGx+GgKARQaGxkHBZq4Kd+GKA/V+PCm2CFV v0HXy03MGqPdchmgCf0pWoS3iGrPFQ1jNSmeWYFWjSRcaa6DwgaPYxD3MrupnsjLNf 2824qbuetGjvA==
X-Cc: intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, janislacis06@gmail.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, sdf@fomichev.me, sriram.yagnaraman@ericsson.com, kurt@linutronix.de, maciej.fijalkowski@intel.com, hkallweit1@gmail.com, joe@dama.to, rafael@kernel.org, sven.auhagen@voleatech.de, netdev@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, stable@vger.kernel.org
X-In-Reply-To: <20261202002317.3140591-4-antonio@mandelbit.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-Received-Bytes: 15483