DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v3] pipeline: fix double free error for table stats
@ 2023-04-17 11:22 Kamalakannan R
  2023-05-24 21:16 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Kamalakannan R @ 2023-04-17 11:22 UTC (permalink / raw)
  To: dev; +Cc: harshad.suresh.narayane, stable, Cristian Dumitrescu

The pointer to the table statistics data structure needs to be set
to NULL after free inside the table_build_free(), as this function is
called from multiple places, leading to double memory free error.

Similar fix for the learner_build_free() function.

Fixes: 742b0a57f50 ("pipeline: add table statistics to SWX")
Fixes: 4f59d372614 ("pipeline: support learner tables")
Cc: stable@dpdk.org

Signed-off-by: Kamalakannan R <kamalakannan.r@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/pipeline/rte_swx_pipeline.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c
index dea1378095..da37eda231 100644
--- a/lib/pipeline/rte_swx_pipeline.c
+++ b/lib/pipeline/rte_swx_pipeline.c
@@ -8665,6 +8665,7 @@ table_build_free(struct rte_swx_pipeline *p)
 			free(p->table_stats[i].n_pkts_action);
 
 		free(p->table_stats);
+		p->table_stats = NULL;
 	}
 }
 
@@ -9579,6 +9580,7 @@ learner_build_free(struct rte_swx_pipeline *p)
 			free(p->learner_stats[i].n_pkts_action);
 
 		free(p->learner_stats);
+		p->learner_stats = NULL;
 	}
 }
 
-- 
2.34.3


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

* Re: [PATCH v3] pipeline: fix double free error for table stats
  2023-04-17 11:22 [PATCH v3] pipeline: fix double free error for table stats Kamalakannan R
@ 2023-05-24 21:16 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2023-05-24 21:16 UTC (permalink / raw)
  To: Kamalakannan R; +Cc: dev, harshad.suresh.narayane, stable, Cristian Dumitrescu

17/04/2023 13:22, Kamalakannan R:
> The pointer to the table statistics data structure needs to be set
> to NULL after free inside the table_build_free(), as this function is
> called from multiple places, leading to double memory free error.
> 
> Similar fix for the learner_build_free() function.
> 
> Fixes: 742b0a57f50 ("pipeline: add table statistics to SWX")
> Fixes: 4f59d372614 ("pipeline: support learner tables")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Kamalakannan R <kamalakannan.r@intel.com>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>

Applied, thanks.




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

end of thread, other threads:[~2023-05-24 21:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-17 11:22 [PATCH v3] pipeline: fix double free error for table stats Kamalakannan R
2023-05-24 21:16 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).