From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@google.com, andrew+netdev@lunn.ch,
netdev@vger.kernel.org
Cc: Dawei Feng <dawei.feng@seu.edu.cn>,
anthony.l.nguyen@intel.com, jianhao.xu@seu.edu.cn,
stable@vger.kernel.org, Jacob Keller <jacob.e.keller@intel.com>,
Rinitha S <sx.rinitha@intel.com>
Subject: [PATCH net 06/10] ice: fix memory leak in ice_lbtest_prepare_rings()
Date: Tue, 28 Jul 2026 14:09:03 -0700 [thread overview]
Message-ID: <20260728210909.3042004-7-anthony.l.nguyen@intel.com> (raw)
In-Reply-To: <20260728210909.3042004-1-anthony.l.nguyen@intel.com>
From: Dawei Feng <dawei.feng@seu.edu.cn>
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 <dawei.feng@seu.edu.cn>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/ice/ice_ethtool.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index 49371b065845..7eb380be7ed2 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -1069,18 +1069,18 @@ static int ice_lbtest_prepare_rings(struct ice_vsi *vsi)
status = ice_vsi_cfg_lan(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 0;
-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);
--
2.47.1
next prev parent reply other threads:[~2026-07-28 21:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 21:08 [PATCH net 00/10][pull request] Intel Wired LAN Driver Updates 2026-07-28 (idpf, ice, igc, igbvf, e1000) Tony Nguyen
2026-07-28 21:08 ` [PATCH net 01/10] idpf: bound interrupt-vector register fill to the allocated array Tony Nguyen
2026-07-28 21:08 ` [PATCH net 02/10] idpf: adjust TxQ ring count minimum Tony Nguyen
2026-07-28 21:09 ` [PATCH net 03/10] idpf: Fix mailbox IRQ name leak on request failure Tony Nguyen
2026-07-28 21:09 ` [PATCH net 04/10] ice: wait for reset completion in ice_resume() Tony Nguyen
2026-07-28 21:09 ` [PATCH net 05/10] ice: fix VF interrupts cleanup Tony Nguyen
2026-07-28 21:09 ` Tony Nguyen [this message]
2026-07-28 21:09 ` [PATCH net 07/10] ice: suppress DPLL errors during reset recovery Tony Nguyen
2026-07-28 21:09 ` [PATCH net 08/10] igc: remove napi_synchronize() in igc_down() Tony Nguyen
2026-07-28 21:09 ` [PATCH net 09/10] igbvf: Fix leak in TX DMA error cleanup Tony Nguyen
2026-07-28 21:09 ` [PATCH net 10/10] e1000: fix memory leak in e1000_probe() Tony Nguyen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260728210909.3042004-7-anthony.l.nguyen@intel.com \
--to=anthony.l.nguyen@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dawei.feng@seu.edu.cn \
--cc=edumazet@google.com \
--cc=jacob.e.keller@intel.com \
--cc=jianhao.xu@seu.edu.cn \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=sx.rinitha@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox