[dpdk-dev] [PATCH] net/ice/base: fix out of memory bound for MAC addresses

Subsystems: networking drivers, the rest

3 messages, 2 authors, 2021-03-24 · open the first message on its own page

[dpdk-dev] [PATCH] net/ice/base: fix out of memory bound for MAC addresses

From: Qi Zhang <hidden>
Date: 2021-03-17 05:58:36

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 <redacted>
Signed-off-by: Qi Zhang <redacted>
---
 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

Re: [dpdk-dev] [PATCH] net/ice/base: fix out of memory bound for MAC addresses

From: Yang, Qiming <hidden>
Date: 2021-03-18 02:07:37

quoted hunk
-----Original Message-----
From: Zhang, Qi Z <redacted>
Sent: Wednesday, March 17, 2021 14:02
To: Yang, Qiming <redacted>
Cc: dev@dpdk.org; Yigit, Ferruh <redacted>; Zhang, Qi Z
[off-list ref]; stable@dpdk.org
Subject: [PATCH] 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.

Fixes: f9cf4f864150 ("net/ice: support device initialization")
Cc: stable@dpdk.org

Reported-by: Ferruh Yigit <redacted>
Signed-off-by: Qi Zhang <redacted>
---
 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
Acked-by: Qiming Yang <redacted>

Re: [dpdk-dev] [PATCH] net/ice/base: fix out of memory bound for MAC addresses

From: Zhang, Qi Z <hidden>
Date: 2021-03-24 13:03:56

-----Original Message-----
From: Yang, Qiming <redacted>
Sent: Thursday, March 18, 2021 10:07 AM
To: Zhang, Qi Z <redacted>
Cc: dev@dpdk.org; Yigit, Ferruh <redacted>; stable@dpdk.org
Subject: RE: [PATCH] net/ice/base: fix out of memory bound for MAC
addresses

quoted
-----Original Message-----
From: Zhang, Qi Z <redacted>
Sent: Wednesday, March 17, 2021 14:02
To: Yang, Qiming <redacted>
Cc: dev@dpdk.org; Yigit, Ferruh <redacted>; Zhang, Qi Z
[off-list ref]; stable@dpdk.org
Subject: [PATCH] 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.

Fixes: f9cf4f864150 ("net/ice: support device initialization")
Cc: stable@dpdk.org

Reported-by: Ferruh Yigit <redacted>
Signed-off-by: Qi Zhang <redacted>
---
 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
Acked-by: Qiming Yang <redacted>
Applied to dpdk-next-net-intel.

Thanks
Qi
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help