Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=185.70.43.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795931995; b=S0nbUu5c8SiMGeXAUct9+KnsRv1efq3plVldlNckTJcOdWXWuHgz9O1gBOGfHGiYwliO mf5I2H2NOi1NYxJn2ch/tDv2KXtDCPek47PA+UiNvRcSwE2u5eqQZvF9vza5WSXtO39hw YoVu20wejTQTG9fmMt7qfs9QfD9WBpBo6qjO/siyyjTBpoRE4M2ftCXmXNPPYFfqWTktZ s81PLsObiABkbkejmt4ZRD7YuAgHc6DyJ607FuVbAFPrYp5/LLqkJhJwfvBIaw9mhsbza v9AtLHd55VOvwkxrWJYhwvUdbOz4mjZXVUcjh76dlhCZJcLrnYwJLxlXU/d2ksAeQXg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795931995; h=DMARC-Filter:DKIM-Signature:Date:To:From:Cc:Subject:Message-ID: Feedback-ID:X-Pm-Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=99io8xY6rV1J5elAUzJ6j1vYnMzCyCPpdAyB0uvB/fM=; b=a9vtux4lYwMCxd4BBU8kYvbCavSsv2iN1ZoM1DUaQpFn8uKn7XysuK4aeAERLR4Djpjt tnsyKWwf+ZT+onSiGcNXVzeiXvJvF5f4r4IiuN1OqdloW2hHC8x0AkDQNtC4cKt/bIoP/ UrqsDU/HjU4D+qs+5DvDthBiD0i2C79Yso1Q4t3TRVkZnQ5gml26TOF0TnV1jUhwiK4ej ub14P6XIja7xI+IDmSBvAVXFEHOvAPT4tAkqzNVvsrENxX6BavjRent7ndHbLJWeXuKZr WCnZP1V6goGA7d2n2vFU+eOMM2aZs58RmpnZ+PRuAfHVUCHeeuoELW2LqoFGv7mHNSg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=jaeyeong.cc; spf=pass smtp.mailfrom=jaeyeong.cc; dkim=pass header.d=jaeyeong.cc header.i=@jaeyeong.cc header.a=rsa-sha256 header.s=protonmail2 header.b=PIgh1rR9; arc=none smtp.remote-ip=185.70.43.18 Received: from mail-4318.protonmail.ch (mail-4318.protonmail.ch [185.70.43.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BFA8606A324; Sun, 29 Nov 2026 05:59:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9BFA8606A324 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=jaeyeong.cc Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=jaeyeong.cc Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=jaeyeong.cc header.i=@jaeyeong.cc header.a=rsa-sha256 header.s=protonmail2 header.b=PIgh1rR9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jaeyeong.cc; s=protonmail2; t=1795931991; x=1796191191; bh=99io8xY6rV1J5elAUzJ6j1vYnMzCyCPpdAyB0uvB/fM=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=PIgh1rR9JLByh+wzTfoEbTtoeLJM+fSLwiqziQ4TtWUlCCAXn+daMo0SiykOvcaZE leh0VjmCMct+qFxwQvEkv3vlCfFOYUT57CrqG/HX70xO01mzNKsuvh9aVzSswENzJW HokfnGLl+X+hvvnyHdirycgSw8ga5VWa8BFa9yqv3sdu9e8mntM6z+yEfGL/GC6LTH ai3ODdtX1GNQbX2N7uHsj0wvbCgwPK/xogn2f4uMZ/d3D1lQP7LCW1Q3R44J40bGjg kWNsWF7wHJ5TFYBOErqxfvqDoxepcc0ejKu2ANtbtkWIB4xwjnkQw2VJ1Lz1jxPbym mju0SUETMch3A== Date: Sun, 29 Nov 2026 05:59:44 +0000 To: Tony Nguyen , Przemek Kitszel From: Jaeyeong Lee Cc: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, bpf@vger.kernel.org, Jaeyeong Lee , stable@vger.kernel.org Subject: [PATCH net] ice: fix XDP ring leaks on setup failures Message-ID: <20261129055937.273668-1-lee@jaeyeong.cc> Feedback-ID: 177356447:user:proton X-Pm-Message-ID: fe1d52c2572d6f1f6da8ffbf59988030f079f048 X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable When the ring statistics allocation fails, the XDP ring has not yet been published in vsi->xdp_rings. ice_free_tx_ring() only releases the resources owned by the ring, not the ring allocation itself, so the ring is leaked. If ice_setup_tx_ring() fails, it leaves desc NULL. The unwind loop consequently skips that ring and leaks its ring statistics. The caller releases the ring allocation, but not the statistics allocation. Free an unpublished ring directly when statistics allocation fails. Unwind every published ring regardless of whether descriptor allocation completed so that both fully and partially initialized rings release their resources. Fixes: 288ecf491b16 ("ice: Accumulate ring statistics over reset") Cc: stable@vger.kernel.org Signed-off-by: Jaeyeong Lee --- drivers/net/ethernet/intel/ice/ice_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethern= et/intel/ice/ice_main.c index 47c6798c9..522492d58 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -2542,7 +2542,7 @@ static int ice_xdp_alloc_setup_rings(struct ice_vsi *= vsi) =20 =09=09ring_stats =3D kzalloc_obj(*ring_stats); =09=09if (!ring_stats) { -=09=09=09ice_free_tx_ring(xdp_ring); +=09=09=09kfree(xdp_ring); =09=09=09goto free_xdp_rings; =09=09} =20 @@ -2568,7 +2568,7 @@ static int ice_xdp_alloc_setup_rings(struct ice_vsi *= vsi) =20 free_xdp_rings: =09for (; i >=3D 0; i--) { -=09=09if (vsi->xdp_rings[i] && vsi->xdp_rings[i]->desc) { +=09=09if (vsi->xdp_rings[i]) { =09=09=09kfree_rcu(vsi->xdp_rings[i]->ring_stats, rcu); =09=09=09vsi->xdp_rings[i]->ring_stats =3D NULL; =09=09=09ice_free_tx_ring(vsi->xdp_rings[i]); --=20 2.43.0