@@ -15598,27 +15598,27 @@ static int i40e_init_recovery_mode(struct i40e_pf *pf, struct i40e_hw *hw)
v_idx = i40e_vsi_mem_alloc(pf, I40E_VSI_MAIN);
if (v_idx < 0) {
err = v_idx;
- goto err_switch_setup;
+ goto err_vsis;
}
pf->lan_vsi = v_idx;
vsi = pf->vsi[v_idx];
if (!vsi) {
err = -EFAULT;
- goto err_switch_setup;
+ goto err_vsis;
}
vsi->alloc_queue_pairs = 1;
err = i40e_config_netdev(vsi);
if (err)
- goto err_switch_setup;
+ goto err_vsis;
err = register_netdev(vsi->netdev);
if (err)
- goto err_switch_setup;
+ goto err_vsis;
vsi->netdev_registered = true;
i40e_dbg_pf_init(pf);
err = i40e_setup_misc_vector_for_recovery_mode(pf);
if (err)
- goto err_switch_setup;
+ goto err_vsis;
/* tell the firmware that we're starting */
i40e_send_version(pf);
@@ -15628,7 +15628,8 @@ static int i40e_init_recovery_mode(struct i40e_pf *pf, struct i40e_hw *hw)
round_jiffies(jiffies + pf->service_timer_period));
return 0;
-
+err_vsis:
+ kfree(pf->vsi);
err_switch_setup:
i40e_reset_interrupt_capability(pf);
timer_shutdown_sync(&pf->service_timer);
In i40e_init_recovery_mode, pf->vsi is allocated without free, causing a memleak. This patch adds deallocation operations for pf->vsi in each and every error-handling paths after pf->vsi's. Fixes: 4ff0ee1af016 ("i40e: Introduce recovery mode support") Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn> --- drivers/net/ethernet/intel/i40e/i40e_main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)