Skip to contentSkip to conversation

net/ice: fix illegal pointer access in dev init

PATCH In review Wenwu Ma 2 participants 2 messages Apr 1, 2021 Network drivers

lore
Share & tools
lore

Wenwu Ma

author
#0 lore raw

PATCH 1/1 net/ice: fix illegal pointer access in dev init

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.

---
 drivers/net/ice/ice_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ice/ice_ethdev.c +2 -2
index 9c9b84a93..81db5f097 100644
@@ -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");
Signature · 1 line
2.25.1
#1 lore raw
Quoted 10 lines

-----Original Message-----
From: Ma, WenwuX <[email protected]>
Sent: Thursday, April 1, 2021 11:21 PM
To: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: [PATCH] net/ice: fix illegal pointer access in dev init

Quoted 6 lines

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.

---

The patch is duplicated with
http://patchwork.dpdk.org/project/dpdk/patch/[email protected]/
which already be applied.