net/i40e/base: fix resource leakage
authorQiming Chen <chenqiming_huawei@163.com>
Sat, 21 Aug 2021 06:30:08 +0000 (14:30 +0800)
committerQi Zhang <qi.z.zhang@intel.com>
Wed, 15 Sep 2021 01:28:24 +0000 (03:28 +0200)
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: 49ea51605be4 ("net/i40e/base: gracefully clean the resources")
Cc: stable@dpdk.org
Signed-off-by: Qiming Chen <chenqiming_huawei@163.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/i40e/base/i40e_adminq.c

index 0da45f0..235667d 100644 (file)
@@ -468,7 +468,7 @@ 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;
@@ -476,6 +476,10 @@ enum i40e_status_code i40e_init_arq(struct i40e_hw *hw)
 
 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;