patch 'app/testpmd: fix error handling in flow API commands' has been queued to stable release 24.11.9
luca.boccassi at gmail.com
luca.boccassi at gmail.com
Tue Oct 27 12:48:51 CET 2026
Hi,
FYI, your patch has been queued to stable release 24.11.9
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 10/29/26. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable
This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/02145f40662af5e75dc1f7a15a50ab986fcc0436
Thanks.
Luca Boccassi
---
>From 02145f40662af5e75dc1f7a15a50ab986fcc0436 Mon Sep 17 00:00:00 2001
From: Kiran Kumar K <kirankumark at marvell.com>
Date: Mon, 7 Sep 2026 09:18:31 +0530
Subject: [PATCH] app/testpmd: fix error handling in flow API commands
[ upstream commit f713f8f0217f7b5cd1eb98027f88a64ebc5176be ]
Fix two robustness issues in the flow API command paths
- port_flow_configure() committed the new queue attributes and job list
before rte_flow_configure() succeeded, leaving the port state
inconsistent on failure. Build the job list locally, free it on error,
and update the port only after configure succeeds.
- port_flow_create() and port_queue_flow_create() indexed ports[port_id]
without validating the port id. Add an rte_eth_dev_is_valid_port()
check before accessing the array.
Fixes: 9ad3a41ab2a1 ("app/testpmd: add flow engine configuration")
Fixes: 938a184a1870 ("app/testpmd: implement basic support for flow API")
Fixes: ecdc927b99f2 ("app/testpmd: add async flow create/destroy operations")
Signed-off-by: Kiran Kumar K <kirankumark at marvell.com>
---
app/test-pmd/config.c | 35 ++++++++++++++++++++++++++++-------
1 file changed, 28 insertions(+), 7 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 2b573bb17bb..60b35396af1 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1804,6 +1804,7 @@ port_flow_configure(portid_t port_id,
{
struct rte_port *port;
struct rte_flow_error error;
+ struct queue_job_list *job_list;
const struct rte_flow_queue_attr *attr_list[nb_queue];
int std_queue;
@@ -1811,23 +1812,31 @@ port_flow_configure(portid_t port_id,
port_id == (portid_t)RTE_PORT_ALL)
return -EINVAL;
port = &ports[port_id];
- port->queue_nb = nb_queue;
- port->queue_sz = queue_attr->size;
for (std_queue = 0; std_queue < nb_queue; std_queue++)
attr_list[std_queue] = queue_attr;
- free(port->job_list);
- port->job_list = calloc(nb_queue, sizeof(*port->job_list));
- if (port->job_list == NULL) {
+
+ /* Build the new job list before touching the device or port state. */
+ job_list = calloc(nb_queue, sizeof(*job_list));
+ if (job_list == NULL) {
TESTPMD_LOG(ERR, "Failed to allocate memory for operations tracking on port %u\n",
port_id);
return -ENOMEM;
}
for (unsigned int i = 0; i < nb_queue; i++)
- LIST_INIT(&port->job_list[i]);
+ LIST_INIT(&job_list[i]);
+
/* Poisoning to make sure PMDs update it in case of error. */
memset(&error, 0x66, sizeof(error));
- if (rte_flow_configure(port_id, port_attr, nb_queue, attr_list, &error))
+ if (rte_flow_configure(port_id, port_attr, nb_queue, attr_list, &error)) {
+ free(job_list);
return port_flow_complain(&error);
+ }
+
+ /* Commit new state only after configure and allocation succeed. */
+ free(port->job_list);
+ port->job_list = job_list;
+ port->queue_nb = nb_queue;
+ port->queue_sz = queue_attr->size;
printf("Configure flows on port %u: "
"number of queues %d with %d elements\n",
port_id, nb_queue, queue_attr->size);
@@ -2840,6 +2849,12 @@ port_queue_flow_create(portid_t port_id, queueid_t queue_id,
struct rte_flow_action_age *age = age_action_get(actions);
struct queue_job *job;
+ if (!rte_eth_dev_is_valid_port(port_id)) {
+ rte_flow_error_set(&error, ENODEV, RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+ NULL, rte_strerror(ENODEV));
+ return port_flow_complain(&error);
+ }
+
port = &ports[port_id];
if (port->flow_list) {
if (port->flow_list->id == UINT32_MAX) {
@@ -3817,6 +3832,12 @@ port_flow_create(portid_t port_id,
struct port_flow_tunnel *pft = NULL;
struct rte_flow_action_age *age = age_action_get(actions);
+ if (!rte_eth_dev_is_valid_port(port_id)) {
+ rte_flow_error_set(&error, ENODEV, RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+ NULL, rte_strerror(ENODEV));
+ return port_flow_complain(&error);
+ }
+
port = &ports[port_id];
if (port->flow_list) {
if (port->flow_list->id == UINT32_MAX) {
--
2.47.3
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-10-27 11:43:55.177701163 +0000
+++ 0037-app-testpmd-fix-error-handling-in-flow-API-commands.patch 2026-10-27 11:43:53.546060440 +0000
@@ -1 +1 @@
-From f713f8f0217f7b5cd1eb98027f88a64ebc5176be Mon Sep 17 00:00:00 2001
+From 02145f40662af5e75dc1f7a15a50ab986fcc0436 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit f713f8f0217f7b5cd1eb98027f88a64ebc5176be ]
+
@@ -20 +21,0 @@
-Cc: stable at dpdk.org
@@ -28 +29 @@
-index aa03eb99cc..9d1fa2f4d1 100644
+index 2b573bb17bb..60b35396af1 100644
@@ -31 +32 @@
-@@ -1844,6 +1844,7 @@ port_flow_configure(portid_t port_id,
+@@ -1804,6 +1804,7 @@ port_flow_configure(portid_t port_id,
@@ -36,2 +37 @@
- const struct rte_flow_queue_attr **attr_list =
- alloca(sizeof(struct rte_flow_queue_attr *) * nb_queue);
+ const struct rte_flow_queue_attr *attr_list[nb_queue];
@@ -39 +39,2 @@
-@@ -1852,23 +1853,31 @@ port_flow_configure(portid_t port_id,
+
+@@ -1811,23 +1812,31 @@ port_flow_configure(portid_t port_id,
@@ -78 +79 @@
-@@ -2881,6 +2890,12 @@ port_queue_flow_create(portid_t port_id, queueid_t queue_id,
+@@ -2840,6 +2849,12 @@ port_queue_flow_create(portid_t port_id, queueid_t queue_id,
@@ -91 +92 @@
-@@ -3858,6 +3873,12 @@ port_flow_create(portid_t port_id,
+@@ -3817,6 +3832,12 @@ port_flow_create(portid_t port_id,
More information about the stable
mailing list