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 EAB5EA034F; Thu, 1 Apr 2021 03:31:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A6E63140F79; Thu, 1 Apr 2021 03:31:31 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 6F1EA40142 for ; Thu, 1 Apr 2021 03:31:30 +0200 (CEST) IronPort-SDR: kwggwD9UMi60PCp9038u2H74z7rSGTEkIRsiWnkaPJAV/roVdc0Wxpt7eVFlKMW0cpRMJZEq8O deKoFE7T8ePg== X-IronPort-AV: E=McAfee;i="6000,8403,9940"; a="189896617" X-IronPort-AV: E=Sophos;i="5.81,295,1610438400"; d="scan'208";a="189896617" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2021 18:31:28 -0700 IronPort-SDR: Y4a3LMrf1Im261HWlQOrjx+d6JeWJQYH+RcR3UQKVgwI6IpBbkwqj/FVTFcPIyta5hj08dPPmi FOm3joTJjw3Q== X-IronPort-AV: E=Sophos;i="5.81,295,1610438400"; d="scan'208";a="517132332" Received: from unknown (HELO localhost.localdomain) ([10.240.183.109]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2021 18:31:27 -0700 From: Wenwu Ma To: qiming.yang@intel.com, qi.z.zhang@intel.com Cc: dev@dpdk.org Date: Thu, 1 Apr 2021 13:24:53 +0000 Message-Id: <20210401132453.17786-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..115fa712e 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, + 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.25.1