[2/2] test/reorder: fix double free of drained buffers

Message ID 20230107151939.2540148-3-vfialko@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series lib/reorder: fix drain/free issues |

Checks

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

Commit Message

Volodymyr Fialko Jan. 7, 2023, 3:19 p.m. UTC
  Set to zero array of drained buffers after free, to prevent freeing them
one more time.
Discovered with enabled `RTE_LIBRTE_MEMPOOL_DEBUG`.

Fixes: ecd867faa860 ("test/reorder: fix freeing mbuf twice")

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
---
 app/test/test_reorder.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

David Marchand Jan. 26, 2023, 3:51 p.m. UTC | #1
On Sat, Jan 7, 2023 at 4:20 PM Volodymyr Fialko <vfialko@marvell.com> wrote:
>
> Set to zero array of drained buffers after free, to prevent freeing them
> one more time.
> Discovered with enabled `RTE_LIBRTE_MEMPOOL_DEBUG`.

Good catch, having those debug options enabled in the CI could be interesting.
Cc: CI people, for info.
  
Stephen Hemminger Feb. 7, 2023, 4:25 p.m. UTC | #2
On Sat, 7 Jan 2023 16:19:39 +0100
Volodymyr Fialko <vfialko@marvell.com> wrote:

> Set to zero array of drained buffers after free, to prevent freeing them
> one more time.
> Discovered with enabled `RTE_LIBRTE_MEMPOOL_DEBUG`.
> 
> Fixes: ecd867faa860 ("test/reorder: fix freeing mbuf twice")
> 
> Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>

Maybe include the actual test failure log next time.

Looks correct to me.
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
  

Patch

diff --git a/app/test/test_reorder.c b/app/test/test_reorder.c
index f0714a5c18..7b5e590bac 100644
--- a/app/test/test_reorder.c
+++ b/app/test/test_reorder.c
@@ -278,6 +278,7 @@  test_reorder_drain(void)
 		goto exit;
 	}
 	rte_pktmbuf_free(robufs[0]);
+	memset(robufs, 0, sizeof(robufs));
 
 	/* Insert more packets
 	 * RB[] = {NULL, NULL, NULL, NULL}
@@ -313,6 +314,7 @@  test_reorder_drain(void)
 	for (i = 0; i < 3; i++) {
 		rte_pktmbuf_free(robufs[i]);
 	}
+	memset(robufs, 0, sizeof(robufs));
 
 	/*
 	 * RB[] = {NULL, NULL, NULL, NULL}