]> git.hungrycats.org Git - linux/commit
ice: dpll: fix memory leak in ice_dpll_init_info error paths
authorZhaoJinming <zhaojinming@uniontech.com>
Fri, 29 May 2026 05:37:33 +0000 (13:37 +0800)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Mon, 22 Jun 2026 21:44:50 +0000 (14:44 -0700)
commit20da495f2df0fd4adc435d3d621366e8c807539c
tree4f8e4e0019890cc52fa0377754f0ec568c408059
parenta903afff66d7379c6ece42bd18b2a17f4c79d1a9
ice: dpll: fix memory leak in ice_dpll_init_info error paths

Several error return paths in ice_dpll_init_info() directly return
without freeing previously allocated resources, causing memory leaks:

- When de->input_prio allocation fails, d->inputs is leaked
- When dp->input_prio allocation fails, d->inputs and de->input_prio
  are leaked
- When ice_get_cgu_rclk_pin_info() fails, all previously allocated
  inputs/outputs/input_prio are leaked
- When ice_dpll_init_pins_info(RCLK_INPUT) fails, same resources
  are leaked

Fix this by jumping to the deinit_info label which properly calls
ice_dpll_deinit_info() to free all allocated resources.

Fixes: d7999f5ea64b ("ice: implement dpll interface to control cgu")
Signed-off-by: ZhaoJinming <zhaojinming@uniontech.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@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_dpll.c