From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dJhM2NnZ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48B231F0089F; Mon, 30 Nov 2026 06:02:10 +0000 (UTC) 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== Subject: Re: [PATCH net] ice: fix XDP ring leaks on setup failures From: netdev-bot+sashiko@kernel.org To: lee@jaeyeong.cc 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 Date: Mon, 30 Nov 2026 06:02:09 +0000 Message-ID: <179601852983.3146.4821173856827528209@kernel.org> In-Reply-To: <20261129055937.273668-1-lee@jaeyeong.cc> References: <20261129055937.273668-1-lee@jaeyeong.cc> X-sashiko-severity: High Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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 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