patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Wenbo Cao <caowenbo@mucse.com>
To: caowenbo@mucse.com
Cc: Kamalakannan R <kamalakannan.r@intel.com>,
	stable@dpdk.org,
	Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Subject: [PATCH 2/3] pipeline: fix double free for table stats
Date: Wed, 31 May 2023 05:23:32 +0000	[thread overview]
Message-ID: <20230531052333.132446-2-caowenbo@mucse.com> (raw)
In-Reply-To: <20230531052333.132446-1-caowenbo@mucse.com>

From: Kamalakannan R <kamalakannan.r@intel.com>

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: 742b0a57f50e ("pipeline: add table statistics to SWX")
Fixes: 4f59d3726147 ("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.27.0


      reply	other threads:[~2023-05-31 10:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31  5:23 [PATCH 1/3] ring: fix dequeue parameter name Wenbo Cao
2023-05-31  5:23 ` Wenbo Cao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230531052333.132446-2-caowenbo@mucse.com \
    --to=caowenbo@mucse.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=kamalakannan.r@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).