diff mbox series

pdump: fix uninit not freeing statistics memzone

Message ID 20211026115301.5456-1-konstantin.ananyev@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show
Series pdump: fix uninit not freeing statistics memzone | expand

Checks

Context Check Description
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/checkpatch success coding style OK

Commit Message

Ananyev, Konstantin Oct. 26, 2021, 11:53 a.m. UTC
rte_pdump_init() always allocates new memzone for pdump_stats.
Though rte_pdump_uninit() never frees it.
So the following combination will always fail:
rte_pdump_init(); rte_pdump_uninit(); rte_pdump_init();
The issue was caught by pdump_autotest UT.
While first test run successful, any consecutive runs
of this test-case will fail.
Fix the issue by calling rte_memzone_free() for statistics memzone.

Fixes: 10f726efe26c ("pdump: support pcapng and filtering")

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 lib/pdump/rte_pdump.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Pattan, Reshma Oct. 26, 2021, 4:54 p.m. UTC | #1
> -----Original Message-----
> From: Ananyev, Konstantin <konstantin.ananyev@intel.com>
.
> 
> Fixes: 10f726efe26c ("pdump: support pcapng and filtering")

The changes looks ok. In the commit message we should also add CC: with author name and email id below the fixes line.

> 
> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by:  Reshma Pattan <reshma.pattan@intel.com>
Stephen Hemminger Oct. 26, 2021, 7:57 p.m. UTC | #2
On Tue, 26 Oct 2021 12:53:01 +0100
Konstantin Ananyev <konstantin.ananyev@intel.com> wrote:

> diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c
> index 71602685d5..a708935861 100644
> --- a/lib/pdump/rte_pdump.c
> +++ b/lib/pdump/rte_pdump.c
> @@ -74,6 +74,7 @@ static const char MZ_RTE_PDUMP_STATS[] = "rte_pdump_stats";
>  static struct {
>  	struct rte_pdump_stats rx[RTE_MAX_ETHPORTS][RTE_MAX_QUEUES_PER_PORT];
>  	struct rte_pdump_stats tx[RTE_MAX_ETHPORTS][RTE_MAX_QUEUES_PER_PORT];
> +	const struct rte_memzone *mz;
>  } *pdump_stats;

Thanks for fixing.

Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Thomas Monjalon Nov. 3, 2021, 11:54 a.m. UTC | #3
26/10/2021 21:57, Stephen Hemminger:
> On Tue, 26 Oct 2021 12:53:01 +0100
> Konstantin Ananyev <konstantin.ananyev@intel.com> wrote:
> 
> > diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c
> > index 71602685d5..a708935861 100644
> > --- a/lib/pdump/rte_pdump.c
> > +++ b/lib/pdump/rte_pdump.c
> > @@ -74,6 +74,7 @@ static const char MZ_RTE_PDUMP_STATS[] = "rte_pdump_stats";
> >  static struct {
> >  	struct rte_pdump_stats rx[RTE_MAX_ETHPORTS][RTE_MAX_QUEUES_PER_PORT];
> >  	struct rte_pdump_stats tx[RTE_MAX_ETHPORTS][RTE_MAX_QUEUES_PER_PORT];
> > +	const struct rte_memzone *mz;
> >  } *pdump_stats;
> 
> Thanks for fixing.
> 
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>

Applied, thanks.
diff mbox series

Patch

diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c
index 71602685d5..a708935861 100644
--- a/lib/pdump/rte_pdump.c
+++ b/lib/pdump/rte_pdump.c
@@ -74,6 +74,7 @@  static const char MZ_RTE_PDUMP_STATS[] = "rte_pdump_stats";
 static struct {
 	struct rte_pdump_stats rx[RTE_MAX_ETHPORTS][RTE_MAX_QUEUES_PER_PORT];
 	struct rte_pdump_stats tx[RTE_MAX_ETHPORTS][RTE_MAX_QUEUES_PER_PORT];
+	const struct rte_memzone *mz;
 } *pdump_stats;
 
 /* Create a clone of mbuf to be placed into ring. */
@@ -429,6 +430,7 @@  rte_pdump_init(void)
 		return -1;
 	}
 	pdump_stats = mz->addr;
+	pdump_stats->mz = mz;
 
 	ret = rte_mp_action_register(PDUMP_MP, pdump_server);
 	if (ret && rte_errno != ENOTSUP)
@@ -441,6 +443,11 @@  rte_pdump_uninit(void)
 {
 	rte_mp_action_unregister(PDUMP_MP);
 
+	if (pdump_stats != NULL) {
+		rte_memzone_free(pdump_stats->mz);
+		pdump_stats = NULL;
+	}
+
 	return 0;
 }