Currently, during `dev_init`, we try to create a security context. At that
point we have already initialized the rte_flow engines, so any subsequent
failures must trigger flow engines uninit. However, if we fail to create a
security context (or if its initialization fails), we do not uninit the
rte_flow engines. Fix the code to do so on failure.

Fixes: 45570d7e4439 ("net/iavf: fix resource leak on probing failure")
Cc: [email protected]
Cc: [email protected]

Signed-off-by: Anatoly Burakov <[email protected]>
---
 drivers/net/intel/iavf/iavf_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/intel/iavf/iavf_ethdev.c 
b/drivers/net/intel/iavf/iavf_ethdev.c
index 2ac4dbdac4f..2b2eb4a93f8 100644
--- a/drivers/net/intel/iavf/iavf_ethdev.c
+++ b/drivers/net/intel/iavf/iavf_ethdev.c
@@ -3153,7 +3153,7 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
                ret = iavf_security_ctx_create(adapter);
                if (ret) {
                        PMD_INIT_LOG(ERR, "failed to create ipsec crypto 
security instance");
-                       goto flow_init_err;
+                       goto security_init_err;
                }
 
                ret = iavf_security_init(adapter);
@@ -3183,6 +3183,7 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
 
 security_init_err:
        iavf_security_ctx_destroy(adapter);
+       iavf_flow_uninit(adapter);
 
 flow_init_err:
        vf->aq_intr_enabled = false;
-- 
2.52.0

Reply via email to