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 61963A0524
	for <public@inbox.dpdk.org>; Tue, 13 Apr 2021 09:21:36 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 2A347160BA2;
	Tue, 13 Apr 2021 09:21:36 +0200 (CEST)
Received: from mga18.intel.com (mga18.intel.com [134.134.136.126])
 by mails.dpdk.org (Postfix) with ESMTP id 1A3ED160BA2
 for <stable@dpdk.org>; Tue, 13 Apr 2021 09:21:34 +0200 (CEST)
IronPort-SDR: QInVdnViMc3m/rOl33gBshFEEckYOmL4cJ6bgb7N9BQ3U6NKHgxtxeGFR5ZkJKA8KHGX/a/fms
 x/Flt5r5nkhg==
X-IronPort-AV: E=McAfee;i="6200,9189,9952"; a="181876913"
X-IronPort-AV: E=Sophos;i="5.82,218,1613462400"; d="scan'208";a="181876913"
Received: from orsmga008.jf.intel.com ([10.7.209.65])
 by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 13 Apr 2021 00:21:33 -0700
IronPort-SDR: 9djJigM32tPGB7/DG2BNczWWtJRVn+GgzHFZE5QW2QwQgIC92MPyFXbP8CUoqdUUL2J/LPk4et
 EGScK3TuEMfA==
X-IronPort-AV: E=Sophos;i="5.82,218,1613462400"; d="scan'208";a="424135817"
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 00:21:31 -0700
From: Wenwu Ma <wenwux.ma@intel.com>
To: build_sh@intel.com
Cc: Wenwu Ma <wenwux.ma@intel.com>,
	stable@dpdk.org
Date: Tue, 13 Apr 2021 19:15:20 +0000
Message-Id: <20210413191520.330023-1-wenwux.ma@intel.com>
X-Mailer: git-send-email 2.25.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-stable] [PATCH] 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>
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>
---
 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