[PATCH] net/enic: fix null dereference in flow query count

Alexey Simakov bigalex934 at gmail.com
Tue Jul 7 13:44:36 CEST 2026


begin_fm() can return NULL when the flow manager is not initialized.
enic_fm_flow_query_count() did not check the return value, leading
to a NULL pointer dereference on flowman_cmd() and end_fm().

Add NULL check that returns -ENOTSUP with a descriptive error
message via rte_flow_error_set().

Fixes: ea7768b5bba8 ("net/enic: add flow implementation based on Flow Manager API")
Cc: stable at dpdk.org

Signed-off-by: Alexey Simakov <bigalex934 at gmail.com>
---
 drivers/net/enic/enic_fm_flow.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/enic/enic_fm_flow.c b/drivers/net/enic/enic_fm_flow.c
index 4b0a513977..28e2a9c1e4 100644
--- a/drivers/net/enic/enic_fm_flow.c
+++ b/drivers/net/enic/enic_fm_flow.c
@@ -2904,6 +2904,13 @@ enic_fm_flow_query_count(struct rte_eth_dev *dev,
 
 	ENICPMD_FUNC_TRACE();
 	fm = begin_fm(pmd_priv(dev));
+
+	if (!fm) {
+		return rte_flow_error_set(error, ENOTSUP,
+			RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+			"enic: flowman is not initialized");
+	}
+
 	query = data;
 	fm_flow = flow->fm;
 	if (!fm_flow->counter_valid) {
-- 
2.34.1



More information about the stable mailing list