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 CEC56A034F; Thu, 1 Apr 2021 05:26:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4FC94140FD4; Thu, 1 Apr 2021 05:26:50 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id BCA9940142 for ; Thu, 1 Apr 2021 05:26:48 +0200 (CEST) IronPort-SDR: QmINTi1WTP57zqd/Sho6LAMRcPvl02QdbrZ8noJpxcdODzZHTTDZsxtyZ3SFG4PG4cAgMTsWdr I25cjliYqGbA== X-IronPort-AV: E=McAfee;i="6000,8403,9940"; a="179673687" X-IronPort-AV: E=Sophos;i="5.81,295,1610438400"; d="scan'208";a="179673687" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2021 20:26:47 -0700 IronPort-SDR: P6h8nRsSM9gof3eJJ2QQ2FCMUZzFLfyoKe5InAXmVaLUjRAKVp1E0QbAgzRKSrG+0950YhKSq3 hTmwJKDAhcDw== X-IronPort-AV: E=Sophos;i="5.81,295,1610438400"; d="scan'208";a="610749801" Received: from unknown (HELO localhost.localdomain) ([10.240.183.109]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2021 20:26:45 -0700 From: Wenwu Ma To: qiming.yang@intel.com, qi.z.zhang@intel.com Cc: dev@dpdk.org Date: Thu, 1 Apr 2021 15:20:31 +0000 Message-Id: <20210401152031.18896-1-wenwux.ma@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] net/ice: fix illegal pointer access in dev init 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" mac_addrs in dev data should be allocated more memory space, Otherwise, traversing mac_addrs in function eth_dev_mac_restore() will result heap-buffer-overflow. Signed-off-by: Wenwu Ma --- drivers/net/ice/ice_ethdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 9c9b84a93..81db5f097 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -808,8 +808,8 @@ ice_init_mac_address(struct rte_eth_dev *dev) (struct rte_ether_addr *)hw->port_info[0].mac.lan_addr, (struct rte_ether_addr *)hw->port_info[0].mac.perm_addr); - dev->data->mac_addrs = - rte_zmalloc(NULL, sizeof(struct rte_ether_addr), 0); + dev->data->mac_addrs = rte_zmalloc(NULL, + RTE_ETHER_ADDR_LEN * ICE_NUM_MACADDR_MAX, 0); if (!dev->data->mac_addrs) { PMD_INIT_LOG(ERR, "Failed to allocate memory to store mac address"); -- 2.25.1