* [PATCH iwl-net] ice: add missing xa_destroy for sched_node_ids
@ 2026-05-14 16:55 Jacob Keller
0 siblings, 0 replies; only message in thread
From: Jacob Keller @ 2026-05-14 16:55 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, Michal Wilczynski
Cc: intel-wired-lan, netdev, Jacob Keller
Commit 16dfa49406bc ("ice: Introduce new parameters in ice_sched_node")
added a sched_node_ids xarray to the port info structure, but never called
xa_destroy on it.
Since xarrays can allocate internal memory, this can result in a memory
leak even if every element in the xarray has been removed.
Add a call to xa_destroy the structure during ice_deinit_hw(), and one to
the unrolling cleanup path during errors in ice_init_hw(). While here,
remove the overly verbose comment explaining the nature of the
sched_node_ids xarray.
This was caught by Sashiko during development of unrelated code.
Fixes: 16dfa49406bc ("ice: Introduce new parameters in ice_sched_node")
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
drivers/net/ethernet/intel/ice/ice_common.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
index b617a6bff891..38d0d7e59494 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.c
+++ b/drivers/net/ethernet/intel/ice/ice_common.c
@@ -1051,14 +1051,13 @@ int ice_init_hw(struct ice_hw *hw)
hw->evb_veb = true;
- /* init xarray for identifying scheduling nodes uniquely */
xa_init_flags(&hw->port_info->sched_node_ids, XA_FLAGS_ALLOC);
/* Query the allocated resources for Tx scheduler */
status = ice_sched_query_res_alloc(hw);
if (status) {
ice_debug(hw, ICE_DBG_SCHED, "Failed to get scheduler allocated resources\n");
- goto err_unroll_alloc;
+ goto err_unroll_xarray;
}
ice_sched_get_psm_clk_freq(hw);
@@ -1146,6 +1145,8 @@ int ice_init_hw(struct ice_hw *hw)
ice_cleanup_fltr_mgmt_struct(hw);
err_unroll_sched:
ice_sched_cleanup_all(hw);
+err_unroll_xarray:
+ xa_destroy(&hw->port_info->sched_node_ids);
err_unroll_alloc:
devm_kfree(ice_hw_to_dev(hw), hw->port_info);
err_unroll_cqinit:
@@ -1186,6 +1187,8 @@ void ice_deinit_hw(struct ice_hw *hw)
/* Clear VSI contexts if not already cleared */
ice_clear_all_vsi_ctx(hw);
+
+ xa_destroy(&hw->port_info->sched_node_ids);
}
/**
---
base-commit: c78bdba7b9666020c0832150a4fc4c0aebc7c6ac
change-id: 20260514-jk-fix-missing-xa-destroy-d3f90f3711be
Best regards,
--
Jacob Keller <jacob.e.keller@intel.com>
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-05-14 16:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-14 16:55 [PATCH iwl-net] ice: add missing xa_destroy for sched_node_ids Jacob Keller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox