net/ice/base: fix out of memory bound for MAC addresses
PATCH 1/1 net/ice/base: fix out of memory bound for MAC addresses
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.
--- drivers/net/ice/ice_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ice/ice_ethdev.c +1 -1
@@ -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" );
Signature · 1 line
2.26.2
Quoted 37 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Wednesday, March 17, 2021 14:02
To: Yang, Qiming <[email protected]>
Cc: [email protected]; Yigit, Ferruh <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]
Subject: [PATCH]net/ice/base: fix out of memory bound for MAC addressesNot enough memory be allocated for
dev->data->mac_addresswhich cause out of bound memory access when iterate all mac addresses by dev_info.max_mac_addrs.Fixes f9cf4f864150 ("net/ice: support device initialization")Reported-by Ferruh Yigit <[email protected]>Signed-off-by Qi Zhang <[email protected]>--- drivers/net/ice/ice_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ice/ice_ethdev.c +2
-2@@ -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" ); --
Quoted 1 line
2.26.2
Zhang, Qi Z
AppliedQuoted 40 lines
-----Original Message-----
From: Yang, Qiming <[email protected]>
Sent: Thursday, March 18, 2021 10:07 AM
To: Zhang, Qi Z <[email protected]>
Cc: [email protected]; Yigit, Ferruh <[email protected]>; [email protected]
Subject: RE: [PATCH]net/ice/base: fix out of memory bound for MAC addressesQuoted 29 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Wednesday, March 17, 2021 14:02
To: Yang, Qiming <[email protected]>
Cc: [email protected]; Yigit, Ferruh <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]
Subject: [PATCH]net/ice/base: fix out of memory bound for MAC addressesNot enough memory be allocated for
dev->data->mac_addresswhich cause out of bound memory access when iterate all mac addresses by dev_info.max_mac_addrs.Fixes f9cf4f864150 ("net/ice: support device initialization")Reported-by Ferruh Yigit <[email protected]>Signed-off-by Qi Zhang <[email protected]>--- drivers/net/ice/ice_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/net/ice/ice_ethdev.cindex8999d441ac..22104250fa100644drivers/net/ice/ice_ethdev.c +0
-0@@ -809,7 +809,7 @@ ice_init_mac_address(struct rte_eth_dev *dev) (struct rte_ether_addr *)hw->port_info[0].mac.perm_addr);
Quoted 11 lines
Quoted 9 lines
drivers/net/ice/ice_ethdev.c +2
-2dev->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
Acked-by Qiming Yang <[email protected]>
Applied to dpdk-next-net-intel.
Thanks
Qi