When ice_send_driver_ver(), ice_flow_init() or ice_reset_fxp_resource()
fails in ice_dev_init(), the error path skips releasing the main VSI
created by ice_pf_setup(). This leaks the VSI structure, its MAC
filters and the VSI in hardware.

Release the main VSI on these error paths.

Fixes: 9481b0902efe ("net/ice: send driver version to firmware")
Fixes: 96b25c496aad ("net/ice: fix memzone leak after device init failure")
Cc: [email protected]

Signed-off-by: Anurag Mandal <[email protected]>
Acked-by: Bruce Richardson <[email protected]>
---
 drivers/net/intel/ice/ice_ethdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/intel/ice/ice_ethdev.c 
b/drivers/net/intel/ice/ice_ethdev.c
index d8d2b818d8..53a14dfd2b 100644
--- a/drivers/net/intel/ice/ice_ethdev.c
+++ b/drivers/net/intel/ice/ice_ethdev.c
@@ -2833,7 +2833,7 @@ ice_dev_init(struct rte_eth_dev *dev)
        ret = ice_send_driver_ver(hw);
        if (ret) {
                PMD_INIT_LOG(ERR, "Failed to send driver version");
-               goto err_pf_setup;
+               goto err_release_vsi;
        }
 
        vsi = pf->main_vsi;
@@ -2905,6 +2905,9 @@ ice_dev_init(struct rte_eth_dev *dev)
        ice_pf_disable_irq0(hw);
        rte_intr_callback_unregister(intr_handle,
                                     ice_interrupt_handler, dev);
+err_release_vsi:
+       ice_release_vsi(pf->main_vsi);
+       pf->main_vsi = NULL;
 err_pf_setup:
        ice_res_pool_destroy(&pf->msix_pool);
 err_msix_pool_init:
-- 
2.25.1

Reply via email to