From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 57A47A00C2; Wed, 17 Mar 2021 06:58:35 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 42DA2242AE3; Wed, 17 Mar 2021 06:58:35 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id DCFDD40689; Wed, 17 Mar 2021 06:58:33 +0100 (CET) IronPort-SDR: 8ljWOJgyS5dsoiyIViOVOTfZQa486zGFxo684v7kW8hxUtJTSfG22binMD5X+PH4sEw+zEvxk8 r4Zr6czRIh7A== X-IronPort-AV: E=McAfee;i="6000,8403,9925"; a="253408528" X-IronPort-AV: E=Sophos;i="5.81,254,1610438400"; d="scan'208";a="253408528" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Mar 2021 22:58:32 -0700 IronPort-SDR: 9dOb+as/KgpBW1LisM5ihMLzlg1fQv2+lAFe2jfWwD2EspQAPnONFaW6bgOVoXskDpIQWYlzK9 L+58mEdHuTuw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,254,1610438400"; d="scan'208";a="605567355" Received: from dpdk51.sh.intel.com ([10.67.111.142]) by fmsmga005.fm.intel.com with ESMTP; 16 Mar 2021 22:58:31 -0700 From: Qi Zhang To: qiming.yang@intel.com Cc: dev@dpdk.org, ferruh.yigit@intel.com, Qi Zhang , stable@dpdk.org Date: Wed, 17 Mar 2021 14:02:19 +0800 Message-Id: <20210317060219.2162370-1-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] net/ice/base: fix out of memory bound for MAC addresses X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Not enough memory be allocated for dev->data->mac_address which cause out of bound memory access when iterate all mac addresses by dev_info.max_mac_addrs. Fixes: f9cf4f864150 ("net/ice: support device initialization") Cc: stable@dpdk.org Reported-by: Ferruh Yigit Signed-off-by: Qi Zhang --- drivers/net/ice/ice_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 8999d441ac..22104250fa 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -809,7 +809,7 @@ ice_init_mac_address(struct rte_eth_dev *dev) (struct rte_ether_addr *)hw->port_info[0].mac.perm_addr); dev->data->mac_addrs = - rte_zmalloc(NULL, sizeof(struct rte_ether_addr), 0); + rte_zmalloc(NULL, sizeof(struct rte_ether_addr) * ICE_NUM_MACADDR_MAX, 0); if (!dev->data->mac_addrs) { PMD_INIT_LOG(ERR, "Failed to allocate memory to store mac address"); -- 2.26.2