Skip to content

Commit

Permalink
net/i40e/base: fix resource leakage
Browse files Browse the repository at this point in the history
[ upstream commit 071eb26 ]

In the i40e_init_arq function, when the i40e_config_arq_regs function
returns from processing failure, the previously applied arq_bufs resource
is not released, which leads to leakage.
The patch is processed in the same way as the i40e_init_asq function,
maintaining a unified coding style.

Fixes: 49ea516 ("net/i40e/base: gracefully clean the resources")

Signed-off-by: Qiming Chen <chenqiming_huawei@163.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
  • Loading branch information
Qiming Chen authored and cpaelzer committed Nov 30, 2021
1 parent a0422d6 commit c0773b5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/net/i40e/base/i40e_adminq.c
Expand Up @@ -468,14 +468,18 @@ enum i40e_status_code i40e_init_arq(struct i40e_hw *hw)
/* initialize base registers */
ret_code = i40e_config_arq_regs(hw);
if (ret_code != I40E_SUCCESS)
goto init_adminq_free_rings;
goto init_config_regs;

/* success! */
hw->aq.arq.count = hw->aq.num_arq_entries;
goto init_adminq_exit;

init_adminq_free_rings:
i40e_free_adminq_arq(hw);
return ret_code;

init_config_regs:
i40e_free_arq_bufs(hw);

init_adminq_exit:
return ret_code;
Expand Down

0 comments on commit c0773b5

Please sign in to comment.