[PATCH v3 05/10] net/iavf: fix generic flow error-path leaks
Anatoly Burakov
anatoly.burakov at intel.com
Tue Oct 20 11:11:28 CEST 2026
If a flow engine fails to initialize, parsers registered by earlier
engines remain allocated. Pattern matching also leaks its item array
when allocation of the match result fails.
Unwind registered parsers on flow initialization failure and free the
item array on match-result allocation failure.
Fixes: ff2d0c345c3b ("net/iavf: support generic flow API")
Cc: stable at dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
drivers/net/intel/iavf/iavf_generic_flow.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/intel/iavf/iavf_generic_flow.c b/drivers/net/intel/iavf/iavf_generic_flow.c
index 14242e6ebb..cd4d4a012b 100644
--- a/drivers/net/intel/iavf/iavf_generic_flow.c
+++ b/drivers/net/intel/iavf/iavf_generic_flow.c
@@ -1821,17 +1821,22 @@ iavf_flow_init(struct iavf_adapter *ad)
if (engine->init == NULL) {
PMD_INIT_LOG(ERR, "Invalid engine type (%d)",
engine->type);
- return -ENOTSUP;
+ ret = -ENOTSUP;
+ goto err;
}
ret = engine->init(ad);
if (ret && ret != -ENOTSUP) {
PMD_INIT_LOG(ERR, "Failed to initialize engine %d",
engine->type);
- return ret;
+ goto err;
}
}
return 0;
+
+err:
+ iavf_flow_uninit(ad);
+ return ret;
}
void
@@ -2047,6 +2052,7 @@ iavf_search_pattern_match_item(const struct rte_flow_item pattern[],
if (!pattern_match_item) {
rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE,
NULL, "Failed to allocate memory.");
+ rte_free(items);
return NULL;
}
--
2.52.0
More information about the dev
mailing list