[dpdk-dev] [PATCH] test/mempool: Fix illegal pointer access in mempool test

Peng, ZhihongX zhihongx.peng at intel.com
Thu Apr 15 04:04:16 CEST 2021


-----Original Message-----
From: dev <dev-bounces at dpdk.org> On Behalf Of Wenwu Ma
Sent: Thursday, April 1, 2021 5:06 AM
To: olivier.matz at 6wind.com; andrew.rybchenko at oktetlabs.ru; dev at dpdk.org
Subject: [dpdk-dev] [PATCH] test/mempool: Fix illegal pointer access in mempool test

The value of parameter private_data_size of function
rte_mempool_create() called in test_mempool() should not be 0, Otherwise, the function rte_pktmbuf_priv_size() called in
rte_pktmbuf_init() will cause heap-buffer-overflow.

Signed-off-by: Wenwu Ma <wenwux.ma at intel.com>
---
 app/test/test_mempool.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c index 084842fda..fc06a9c6f 100644
--- a/app/test/test_mempool.c
+++ b/app/test/test_mempool.c
@@ -543,7 +543,8 @@ test_mempool(void)
 	mp_stack_mempool_iter = rte_mempool_create("test_iter_obj",
 		MEMPOOL_SIZE,
 		MEMPOOL_ELT_SIZE,
-		RTE_MEMPOOL_CACHE_MAX_SIZE, 0,
+		RTE_MEMPOOL_CACHE_MAX_SIZE,
+		sizeof(struct rte_pktmbuf_pool_private),
 		NULL, NULL,
 		my_obj_init, NULL,
 		SOCKET_ID_ANY, 0);
--
2.25.1

Tested-by: Peng Zhihong <zhihongx.peng at intel.com>


More information about the dev mailing list