public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
* [PATCH] app/testpmd: fix memory leak in port flow configure
@ 2026-03-24  8:10 Shani Peretz
  2026-03-24  8:44 ` Dariusz Sosnowski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Shani Peretz @ 2026-03-24  8:10 UTC (permalink / raw)
  To: dev; +Cc: Shani Peretz, stable, Aman Singh, Dariusz Sosnowski

When "flow configure" is issued multiple times on the same port,
port_flow_configure() allocates a new job_list via calloc() without
freeing the previous allocation, leaking it. The old pointer is
simply overwritten.

  testpmd> flow configure 0 queues_number 10 queues_size 256 ...
  testpmd> flow configure 0 queues_number 10 queues_size 256 ...

The patch fixes this by freeing the existing job_list before allocating
the replacement.

Fixes: df503d757b36 ("app/testpmd: fix flow queue job leaks")
Cc: stable@dpdk.org

Signed-off-by: Shani Peretz <shperetz@nvidia.com>
---
 app/test-pmd/config.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index f9f3c542a6..f0a784bf2f 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1836,6 +1836,7 @@ port_flow_configure(portid_t port_id,
 	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) {
 		TESTPMD_LOG(ERR, "Failed to allocate memory for operations tracking on port %u\n",
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] app/testpmd: fix memory leak in port flow configure
  2026-03-24  8:10 [PATCH] app/testpmd: fix memory leak in port flow configure Shani Peretz
@ 2026-03-24  8:44 ` Dariusz Sosnowski
  2026-03-24 14:36 ` Stephen Hemminger
  2026-03-24 15:56 ` Stephen Hemminger
  2 siblings, 0 replies; 4+ messages in thread
From: Dariusz Sosnowski @ 2026-03-24  8:44 UTC (permalink / raw)
  To: Shani Peretz, dev@dpdk.org; +Cc: stable@dpdk.org, Aman Singh

> -----Original Message-----
> From: Shani Peretz <shperetz@nvidia.com>
> Sent: Tuesday, March 24, 2026 9:11 AM
> To: dev@dpdk.org
> Cc: Shani Peretz <shperetz@nvidia.com>; stable@dpdk.org; Aman Singh
> <aman.deep.singh@intel.com>; Dariusz Sosnowski
> <dsosnowski@nvidia.com>
> Subject: [PATCH] app/testpmd: fix memory leak in port flow configure
> 
> When "flow configure" is issued multiple times on the same port,
> port_flow_configure() allocates a new job_list via calloc() without freeing the
> previous allocation, leaking it. The old pointer is simply overwritten.
> 
>   testpmd> flow configure 0 queues_number 10 queues_size 256 ...
>   testpmd> flow configure 0 queues_number 10 queues_size 256 ...
> 
> The patch fixes this by freeing the existing job_list before allocating the
> replacement.
> 
> Fixes: df503d757b36 ("app/testpmd: fix flow queue job leaks")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Shani Peretz <shperetz@nvidia.com>

Reviewed-by: Dariusz Sosnowski <dsosnowski@nvidia.com>

Best regards,
Dariusz Sosnowski

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] app/testpmd: fix memory leak in port flow configure
  2026-03-24  8:10 [PATCH] app/testpmd: fix memory leak in port flow configure Shani Peretz
  2026-03-24  8:44 ` Dariusz Sosnowski
@ 2026-03-24 14:36 ` Stephen Hemminger
  2026-03-24 15:56 ` Stephen Hemminger
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2026-03-24 14:36 UTC (permalink / raw)
  To: Shani Peretz; +Cc: dev, stable, Aman Singh, Dariusz Sosnowski

On Tue, 24 Mar 2026 10:10:44 +0200
Shani Peretz <shperetz@nvidia.com> wrote:

> When "flow configure" is issued multiple times on the same port,
> port_flow_configure() allocates a new job_list via calloc() without
> freeing the previous allocation, leaking it. The old pointer is
> simply overwritten.
> 
>   testpmd> flow configure 0 queues_number 10 queues_size 256 ...
>   testpmd> flow configure 0 queues_number 10 queues_size 256 ...  
> 
> The patch fixes this by freeing the existing job_list before allocating
> the replacement.
> 
> Fixes: df503d757b36 ("app/testpmd: fix flow queue job leaks")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Shani Peretz <shperetz@nvidia.com>
> ---
>  app/test-pmd/config.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index f9f3c542a6..f0a784bf2f 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -1836,6 +1836,7 @@ port_flow_configure(portid_t port_id,
>  	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));

You could use realloc here, but it doesn't matter much

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] app/testpmd: fix memory leak in port flow configure
  2026-03-24  8:10 [PATCH] app/testpmd: fix memory leak in port flow configure Shani Peretz
  2026-03-24  8:44 ` Dariusz Sosnowski
  2026-03-24 14:36 ` Stephen Hemminger
@ 2026-03-24 15:56 ` Stephen Hemminger
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2026-03-24 15:56 UTC (permalink / raw)
  To: Shani Peretz; +Cc: dev, stable, Aman Singh, Dariusz Sosnowski

On Tue, 24 Mar 2026 10:10:44 +0200
Shani Peretz <shperetz@nvidia.com> wrote:

> When "flow configure" is issued multiple times on the same port,
> port_flow_configure() allocates a new job_list via calloc() without
> freeing the previous allocation, leaking it. The old pointer is
> simply overwritten.
> 
>   testpmd> flow configure 0 queues_number 10 queues_size 256 ...
>   testpmd> flow configure 0 queues_number 10 queues_size 256 ...  
> 
> The patch fixes this by freeing the existing job_list before allocating
> the replacement.
> 
> Fixes: df503d757b36 ("app/testpmd: fix flow queue job leaks")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Shani Peretz <shperetz@nvidia.com>

Applied to next-net

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-24 15:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-24  8:10 [PATCH] app/testpmd: fix memory leak in port flow configure Shani Peretz
2026-03-24  8:44 ` Dariusz Sosnowski
2026-03-24 14:36 ` Stephen Hemminger
2026-03-24 15:56 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox