Skip to contentSkip to conversation

app/testpmd: fix flow cfg double-free after reattach

PATCH Applied Maayan Kashani 2 participants 2 messages Jul 6 – Jul 10

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/testpmd: fix flow cfg double-free after reattach

From: Shani Peretz <[email protected]>

When a port is closed via close_port(), port_free_job_list() frees the job_list but does not NULL the pointer or reset queue_nb. If the port is later reattached and "flow configure" is issued, port_flow_configure() frees the dangling job_list pointer, causing a double-free.

Fix this by setting job_list to NULL and resetting queue_nb to zero in port_free_job_list() after freeing.

Fixes 7fadc8039588 ("app/testpmd: fix memory leak in port flow configure")
---
 app/test-pmd/testpmd.c | 2 ++
 1 file changed, 2 insertions(+)
app/test-pmd/testpmd.c +2 -0
index 9a85657840a..ef337a4d144 100644
@@ -3358,6 +3358,8 @@ port_free_job_list(portid_t pi)
 {
 	struct rte_port *port = &ports[pi];
 	free(port->job_list);
+	port->job_list = NULL;
+	port->queue_nb = 0;
 }
 
 static void
Signature · 1 line
2.21.0
#1 lore raw

06/07/2026 13:52, Maayan Kashani:

Quoted 7 lines

From: Shani Peretz <[email protected]>

When a port is closed via close_port(), port_free_job_list() frees the job_list but does not NULL the pointer or reset queue_nb. If the port is later reattached and "flow configure" is issued, port_flow_configure() frees the dangling job_list pointer, causing a double-free.

Quoted 8 lines

Fix this by setting job_list to NULL and resetting queue_nb to zero in port_free_job_list() after freeing.

Fixes 7fadc8039588 ("app/testpmd: fix memory leak in port flow configure")

Applied, thanks.