Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A45E37A858; Thu, 20 Aug 2026 16:48:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787244532; cv=none; b=IO8Igw5lmhdFbd11yrF9De5gQDfmmqXLuIJPXk/0ARHyC1ynJs5xa4qvb9+2XkydyhWLE1HhjPRfG7fNNjSPq/Q9FJR47iwtzH+JvLYOcMkfNbcfnXjyHrye92yEK7dt0FG0hfxYmjJ80mgwscYe7/Am1hfYLPZeBcHRhkw5tGo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787244532; c=relaxed/simple; bh=L8b7MemLg05Mp8ZIkVjuMZLZ9OWErZNaGKmdKLL5LcI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aXCwNWMJGrin9cHV1GlrQkyc5NSFjtUp+TQFuPVQ8SeuPsSz9WIJZy+NoHhV50TynC+RZz3fHkS5FEHeoIWGmpqM4EWuUVG4J5ShxLO3TI0hMB5K0W6SGzAadhXChamZhZmXsqdMqU5TjVbyYNLY8dC3r1Zx6IboYa3H0ahr/T0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=GRY3L7tm; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="GRY3L7tm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECA061F000E9; Thu, 20 Aug 2026 16:48:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787244531; bh=/rpDfyN27uPGbgKa5eQH+SfKc7GzzV1Lllls4SQNLxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GRY3L7tmt+uG2gmYh56lWksAclMPl7VGpUjZorKqZgwd7NqT4byPEfyhrG/MJo7tc ohGXRetgPWJmNTCVB2d+3sZDmtgO0H92sysbHGAd07QHkVxTtiLkjqxt8pJqUnYBlB 3pVJZBhkAoeE0Ksve714byq1kWWiYLmjIhLwkM0g= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dawei Feng , Jacob Keller , Tony Nguyen , Sasha Levin , Rinitha S Subject: [PATCH 5.10 201/235] ice: fix memory leak in ice_lbtest_prepare_rings() Date: Thu, 20 Aug 2026 16:57:17 +0200 Message-ID: <20260820145222.649448711@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260820145216.426568665@linuxfoundation.org> References: <20260820145216.426568665@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dawei Feng [ Upstream commit 3a9de5590da4ffd9e9c541c4c4d492aa2b54cf6e ] ice_lbtest_prepare_rings() frees Rx rings only when ice_vsi_start_all_rx_rings() fails. If ice_vsi_setup_rx_rings() fails after allocating some descriptors, or if ice_vsi_cfg_lan() fails after the Rx rings were prepared, the function reaches the Tx cleanup path without releasing the initialized Rx resources. Fix this by adding separate unwind paths for Rx setup failure and LAN configuration failure. The Rx setup failure path releases the partially prepared Rx rings before freeing Tx rings, while later failures first undo the LAN Tx configuration and then release the Rx rings in reverse setup order. The bug was first flagged by an experimental analysis tool we are developing for kernel memory-management bugs while analyzing v6.13-rc1. The tool is still under development and is not yet publicly available. Manual inspection confirms that the bug is still present in v7.1-rc7. An x86_64 allyesconfig build showed no new warnings. As we do not have an Intel E800 Series adapter available to run the ethtool offline loopback selftest, no runtime testing was able to be performed. Fixes: 0e674aeb0b77 ("ice: Add handler for ethtool selftest") Cc: stable@vger.kernel.org Signed-off-by: Dawei Feng Reviewed-by: Jacob Keller Tested-by: Rinitha S (A Contingent worker at Intel) Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/ice/ice_ethtool.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c @@ -478,18 +478,18 @@ static int ice_lbtest_prepare_rings(stru status = ice_vsi_cfg(vsi); if (status) - goto err_setup_rx_ring; + goto err_cfg_lan; status = ice_vsi_start_all_rx_rings(vsi); if (status) - goto err_start_rx_ring; + goto err_cfg_lan; return status; -err_start_rx_ring: - ice_vsi_free_rx_rings(vsi); -err_setup_rx_ring: +err_cfg_lan: ice_vsi_stop_lan_tx_rings(vsi, ICE_NO_RESET, 0); +err_setup_rx_ring: + ice_vsi_free_rx_rings(vsi); err_setup_tx_ring: ice_vsi_free_tx_rings(vsi);