From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 1F012A0562
	for <public@inbox.dpdk.org>; Tue, 13 Apr 2021 10:09:25 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 12472160C2C;
	Tue, 13 Apr 2021 10:09:25 +0200 (CEST)
Received: from mga14.intel.com (mga14.intel.com [192.55.52.115])
 by mails.dpdk.org (Postfix) with ESMTP id BA8F0160970;
 Tue, 13 Apr 2021 10:09:22 +0200 (CEST)
IronPort-SDR: pqGXuDe3IWPxYzcIjbU3a7Dyau53o+jPGmZSHHkpjPzHTtPqN0vvyp340A1syOWD4Hg18M/4Jx
 iTbTpiEyfUkQ==
X-IronPort-AV: E=McAfee;i="6200,9189,9952"; a="193924269"
X-IronPort-AV: E=Sophos;i="5.82,218,1613462400"; d="scan'208";a="193924269"
Received: from orsmga008.jf.intel.com ([10.7.209.65])
 by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 13 Apr 2021 01:09:21 -0700
IronPort-SDR: 4YOrsCEs6em/UfVFFSQKOKOTfoQk+N+yiSQKeJcc4GDMKbdZpI3e8qH43y303jLWO2yK/pG4NJ
 KxkzbuG6J8uQ==
X-IronPort-AV: E=Sophos;i="5.82,218,1613462400"; d="scan'208";a="424150610"
Received: from unknown (HELO localhost.localdomain) ([10.240.183.109])
 by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 13 Apr 2021 01:09:19 -0700
From: Wenwu Ma <wenwux.ma@intel.com>
To: olivier.matz@6wind.com,
	andrew.rybchenko@oktetlabs.ru
Cc: dev@dpdk.org,
	Wenwu Ma <wenwux.ma@intel.com>,
	stable@dpdk.org
Date: Tue, 13 Apr 2021 20:03:08 +0000
Message-Id: <20210413200308.330346-1-wenwux.ma@intel.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-stable] [v2] test/mempool: fix heap buffer overflow
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Reply-To: 20210331210557.4919-1-wenwux.ma@intel.com
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

Amount of allocated memory was not enough for mempool
which cause buffer overflow when access fields of mempool
private structure in the rte_pktmbuf_priv_size function.

Fixes: 923ceaeac140 ("test/mempool: add unit test cases")
Cc: stable@dpdk.org

Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
---
v2:
- refine commit log. 
---
 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