Skip to contentSkip to conversation

ethdev: fix null error struct in flow configure

PATCH New Maayan Kashani 1 participant 1 message May 29, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ethdev: fix null error struct in flow configure

RTE flow configure returned error value w/o filling the error struct which caused a crash on complain function.

Filling the error struct fixed the issue.

Fixes 4ff58b734bc9 ("ethdev: introduce flow engine configuration")
---
 lib/ethdev/rte_flow.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
lib/ethdev/rte_flow.c +8 -4
index 9f8d8f3dc2d..fe8f43caff7 100644
@@ -1725,21 +1725,21 @@ rte_flow_configure(uint16_t port_id,
 		FLOW_LOG(INFO,
 			"Device with port_id=%"PRIu16" is not configured.",
 			port_id);
-		return -EINVAL;
+		goto error;
 	}
 	if (dev->data->dev_started != 0) {
 		FLOW_LOG(INFO,
 			"Device with port_id=%"PRIu16" already started.",
 			port_id);
-		return -EINVAL;
+		goto error;
 	}
 	if (port_attr == NULL) {
 		FLOW_LOG(ERR, "Port %"PRIu16" info is NULL.", port_id);
-		return -EINVAL;
+		goto error;
 	}
 	if (queue_attr == NULL) {
 		FLOW_LOG(ERR, "Port %"PRIu16" queue info is NULL.", port_id);
-		return -EINVAL;
+		goto error;
 	}
 	if ((port_attr->flags & RTE_FLOW_PORT_FLAG_SHARE_INDIRECT) &&
 	     !rte_eth_dev_is_valid_port(port_attr->host_port_id)) {
@@ -1760,6 +1760,10 @@ rte_flow_configure(uint16_t port_id,
 	return rte_flow_error_set(error, ENOTSUP,
 				  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
 				  NULL, rte_strerror(ENOTSUP));
+error:
+	return rte_flow_error_set(error, EINVAL,
+				  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+				  NULL, rte_strerror(EINVAL));
 }
 
 RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_flow_pattern_template_create, 22.03)
Signature · 1 line
2.21.0