From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=185.70.43.20 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795931995; b=jPvi/Oxt7jeZRmKEER628aSMqySTCKSswQVZ9NL/voeemiZCFRoLiaSgkZjlLiY7505H awnXJ59xbZMgd7G3HT1N4uZsgFXVCM1kMyqI9zg5UjetUKjaD2MRrONu1MIcCIi0peG0k d7CW3Q/I9SDCJ5haDf0vGB1ZDThmECeOOxbapZtLOB8Q5sJZ0S5W69rmVncbf+XLQashL tdN4EnbKXzq9bhoza/8Cs+qRVVK3q11bMg8PtQrOuhzGJdFhBPSEefjg0b7kpOhT3OGU2 YHSXKIcCx/9xgZV5iAuvXPqa2O5/pS6chIa3ErXMWlageFF45EPkXt/XmcghFA2q/3Q== 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=r8eJYzdF5iv1jWP9VYt1wpP+F94LlB/7IZZQZ31u7S/UK3fLHngiInlu4PbYf4J/8Kt6 tMWTEjHUBDmoPHeys89oVMU+LiYybkW7J3XYNogkhjQJWicy04Cgl+i9fdYCN7Rv95c0N SI7mXpgRE+DEXpqGaEM6WG79L1u6ZQIkDkP4s2UOfBZOyoWvzbELz5puBL5WqBCpXloGk sU9XDI2v8Vcdvh7pXQLTj8obmhDcdbslbNYGUa9c70r8kVxeEwDtmDSqp2j+VXgeFfCFB exqmr9yyAwIBnRFWaA+c+ZYCLjl+KkclTq+vRVynTozXx90u+bvBSwg0gbZd39Sbyiw== 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.20 Received: from mail-4320.protonmail.ch (mail-4320.protonmail.ch [185.70.43.20]) (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 9E516606A325 for ; Sun, 29 Nov 2026 05:59:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9E516606A325 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: netdev@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