🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24421

Re: [PATCH net] ice: fix XDP ring leaks on setup failures

#24421
From: netdev-bot+sashiko
Date: Mon, 30 Nov 2026 06:02
91 lines
11259 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 1 · Medium: 0 · 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).

- [High] The patch is titled "ice: fix XDP ring leaks on setup failures"
  and blames 288ecf491b16, but one setup-failure path in…

--

ice: fix XDP ring leaks on setup failures

This patch changes the error unwind in ice_xdp_alloc_setup_rings(). If
the ring_stats allocation fails, the unpublished XDP ring is now freed
directly. The free_xdp_rings loop now unwinds every published ring,
including those whose descriptor allocation did not complete.

> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
> index 47c6798c97e8f..522492d58c507 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c

[ ... ]

> @@ -2568,7 +2568,7 @@ static int ice_xdp_alloc_setup_rings(struct ice_vsi *vsi)
>  
>  free_xdp_rings:
>  	for (; i >= 0; i--) {
> -		if (vsi->xdp_rings[i] && vsi->xdp_rings[i]->desc) {
> +		if (vsi->xdp_rings[i]) {
>  			kfree_rcu(vsi->xdp_rings[i]->ring_stats, rcu);
>  			vsi->xdp_rings[i]->ring_stats = NULL;
>  			ice_free_tx_ring(vsi->xdp_rings[i]);

[Severity: High]
This fixes the two unwind cases inside ice_xdp_alloc_setup_rings(). Is
there still a setup failure in the caller, ice_prepare_xdp_rings(), that
leaks the same ring_stats allocation from 288ecf491b16?

When ice_xdp_alloc_setup_rings() succeeds, every vsi->xdp_rings[i] owns
a kzalloc'd ring_stats, a devm tx_buf array and a dmam descriptor ring.
When cfg_type is not ICE_XDP_CFG_PART, the caller then does:

drivers/net/ethernet/intel/ice/ice_main.c:ice_prepare_xdp_rings() {
    ...
	status = ice_cfg_vsi_lan(vsi->port_info, vsi->idx, vsi->tc_cfg.ena_tc,
				 max_txqs);
	if (status) {
		dev_err(dev, "Failed VSI LAN queue config for XDP, error: %d\n",
			status);
		goto unmap_xdp_rings;
	}
    ...
unmap_xdp_rings:
	ice_unmap_xdp_rings(vsi);
clear_xdp_rings:
	ice_for_each_xdp_txq(vsi, i)
		if (vsi->xdp_rings[i]) {
			kfree_rcu(vsi->xdp_rings[i], rcu);
			vsi->xdp_rings[i] = NULL;
		}
    ...
}

ice_unmap_xdp_rings() only restores the q_vector->tx.tx_ring pointers.
The clear_xdp_rings loop then frees only the ring struct.

ring->ring_stats is never freed on this path, and once the ring is gone
nothing points to it. ice_free_tx_ring() is never called either, so
tx_buf and desc stay on the devres list until the driver unbinds. Each
failed XDP attach or channel reconfiguration would add one more leak per
XDP Tx queue.

The normal teardown in ice_destroy_xdp_rings() calls ice_free_tx_ring(),
then kfree_rcu() on ring_stats, then kfree_rcu() on the ring. Could the
clear_xdp_rings label in ice_prepare_xdp_rings() do the same full
per-ring teardown instead?

That would cover the ice_cfg_vsi_lan() failure as well as both failure
points inside ice_xdp_alloc_setup_rings(). It would also make the
separate unwind in ice_xdp_alloc_setup_rings() unnecessary.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261129055937.273668-1-lee%40jaeyeong.cc
Technical Details
Message-ID: <179601852983.3146.4821173856827528209@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373909-linux-kernel-netdev=dewy.ru
References: <20261129055937.273668-1-lee@jaeyeong.cc>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373909-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] ice: fix XDP ring leaks on setup failures
Date: Mon, 30 Nov 2026 06:02:09 +0000
Organization: Usenet Network
Message-ID: <179601852983.3146.4821173856827528209@kernel.org>
References: <20261129055937.273668-1-lee@jaeyeong.cc>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="1349503"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:MiLwuFdUu4P1trY9wer+cqo0wkk= sha256:g6gXy/knpU7K4UVEwnRTqC884MQks1q4ow6VbJe0OXI= sha1:ItH/L/byGUPK/FMTk6tKTY+g1Hs= sha256:cTyLpVBrXydOvZWpb+eO/A/qzy1nywfJr/WTFYSIInE=
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 88D9A125FC6; Mon, 30 Nov 2026 09:02:31 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.501
X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31 tests=[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 JQxZniSqy0ji; Mon, 30 Nov 2026 09:02:28 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-373909-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id D077D125FC4; Mon, 30 Nov 2026 09:02:19 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 100382409C; Mon, 30 Nov 2026 06:02:18 +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=1796018537; b=L9rMft5ff9+OVSxXIMzo96jDZ5LxwckzrKDsAsYsi+q8oCDAFK4iOpodzV4gv2YudTZd D3oWH9c0T3nOTI9n4nPcUj4P5cGef4SU8l2t9KjHTe2/GNS8bCwVmSJ29SiJtLp4xo49H MTbAqOMqJwtXwGNUDGpAm6dJZwhM+Eh/YU+L8X8o+RSSC/0VNnNBXjZb2/icQp3OXBCnp xOGCjZjOou8iI6CIuRxiwfPF6fWy8e3mxFRkYPX1baJj685ELylwdNTRRAEr15PXxr69Z FkjY/qmgIsVdH7r/PWV5jDwvQQuw+9vr95WW2t8krnNzCagg51tx0I20gQBxeuY2tpg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796018537; 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=tlTUw0o3V9petdu18trztsK18DRWtt4JmQB34+FZjq0=; b=piHTB55LxZ6mhePmnTwOdyWPonA5TreyoL9nff4oK3u56T4vDLqb07vzggutRED0GVzf iY/QpkGLzH65qjFuSJpmPEgKw3o9JKdVTXU0UJFmb7bfmaadm7SgJNqbay7xlu1kVKvC2 DnBYBnaforOHHN3gnR61D/tEQBKN0ni+QV5GLkkyBT3LVDpZHYpVhureorpPOTyontABZ 0L9SeOb2BPNriyApEZrtMEmAeYdAQ0vgkIcdqcAfXcklD7yZX1eLhe19F1TXC90r4iaPi 2tUEHBF339MCYht4vYaILE2ma3h80L7FUn55iZw/JoDr9jCdcWXEEZ4A+G5nnmDT4kg==
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=dJhM2NnZ; 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 93B2E606A32A; Mon, 30 Nov 2026 06:02:17 +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=dJhM2NnZ
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=1796018531; b=NbH0ZCvbg3PHJtX+xZLc+5f8SPI4DmJjz+f/aIxscaA9mYs9ppjjJiCGdJwLvVhzbVnH dnHV2gnQGj/m8XCoeVj6zs+2KSDUNnSl49HH9DbATIG168fYvF7lI3d0nV+JxfexB+j89 q5acMhUPG6lcuHMoCq011sEc6HWwbOvE+S+b0baEfcnDWLSlfjm4qum7hFYcL/Q0VM68R FMzT2t7X4M9adb/u7Ckm9dtARFqPbIH1Vcj/qypzlJPwe68ihkJ+YEraSqSiKhjT/0gE2 WVps69+4n50C5CjlsLxgVopOnQ/xzJVfpcemwnti1QwJ7vQlm8oiLoVkXyomp9iA7SA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796018531; 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=tlTUw0o3V9petdu18trztsK18DRWtt4JmQB34+FZjq0=; b=RIhzBshOUZPH5n4aOVStTTdPAZv4aT/pLonFuWrmczwJ+IwFN8ig5aNj9FIdGVL3X+Md PURTKpePSw4yr4OewhLUdp8hj5T09sWguZE8oSOw8X6g2Pnz6X+emW6tX6CwHHacuKNr2 qLZEeiV+ujFjakYqWn/d0cqWHsiMk8I+0N3gKis33wrOtowfigtA71n06fQUD65MQXFL7 hrkO/6qjSGphxTYg1fEcBtg9CLVZ/BSU9PXIupVkdd3X5jhJHsAkDVshJ3BC/ZvwnrOhE qSeCPJ56fHwGOum7xDsDJ0+yErGjtq2TBilJWXNjgfEywvVzvCYrG30u9tID6EfXsSA==
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=dJhM2NnZ; 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 AB038606A31C; Mon, 30 Nov 2026 06:02:11 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48B231F0089F; Mon, 30 Nov 2026 06:02:10 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796018531; bh=tlTUw0o3V9petdu18trztsK18DRWtt4JmQB34+FZjq0=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=dJhM2NnZRZOt2od+fSW831WURdzizQqiQjjJuK5S0g/VwOqXaSRdKUTXsFgbZejuU kajGzohEWI8xw4tmvo+TM+lsbwtvmV9Ca2k8PjuSV25zluYhJkqPL++neIgcaMrFmx rlXfXxVjKRy0kTJCgbqKKTaDtO8+x38A+S2/U5CenJyld3ykpDU6ydnHe+fYwpEd4i jw6sGNn4Dh4SwH4JAnHGyw8ultkJe5XWusGYTpntZLn5Ur/XosI45ubvdfnGBfM0zj podRBnty9c6D0ziOqjs/32u/vOhArngw8em01q5MoUxkkm9880EdO0qUdAFyD6KkZO 1xj0LZonDhe0A==
X-Cc: 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, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, sdf@fomichev.me, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, bpf@vger.kernel.org, stable@vger.kernel.org
X-In-Reply-To: <20261129055937.273668-1-lee@jaeyeong.cc>
X-sashiko-severity: High
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