DPDK patches and discussions
 help / color / mirror / Atom feed
* Re: [dpdk-dev] [PATCH] net/ice: fix illegal pointer access in dev init
  2021-04-01 13:24 [dpdk-dev] [PATCH] net/ice: fix illegal pointer access in dev init Wenwu Ma
@ 2021-04-01  2:37 ` Stephen Hemminger
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2021-04-01  2:37 UTC (permalink / raw)
  To: Wenwu Ma; +Cc: qiming.yang, qi.z.zhang, dev

On Thu,  1 Apr 2021 13:24:53 +0000
Wenwu Ma <wenwux.ma@intel.com> wrote:

> +	dev->data->mac_addrs = rte_zmalloc(NULL,
> +		sizeof(struct rte_ether_addr) * ICE_NUM_MACADDR_MAX, 0);

This looks like a good place to use rte_calloc().

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH] net/ice: fix illegal pointer access in dev init
@ 2021-04-01 13:24 Wenwu Ma
  2021-04-01  2:37 ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: Wenwu Ma @ 2021-04-01 13:24 UTC (permalink / raw)
  To: qiming.yang, qi.z.zhang; +Cc: 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 <wenwux.ma@intel.com>
---
 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH] net/ice: fix illegal pointer access in dev init
@ 2021-04-01 15:20 Wenwu Ma
  2021-04-01 12:00 ` Zhang, Qi Z
  0 siblings, 1 reply; 4+ messages in thread
From: Wenwu Ma @ 2021-04-01 15:20 UTC (permalink / raw)
  To: qiming.yang, qi.z.zhang; +Cc: 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 <wenwux.ma@intel.com>
---
 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] net/ice: fix illegal pointer access in dev init
  2021-04-01 15:20 Wenwu Ma
@ 2021-04-01 12:00 ` Zhang, Qi Z
  0 siblings, 0 replies; 4+ messages in thread
From: Zhang, Qi Z @ 2021-04-01 12:00 UTC (permalink / raw)
  To: Ma, WenwuX, Yang, Qiming; +Cc: dev



> -----Original Message-----
> From: Ma, WenwuX <wenwux.ma@intel.com>
> Sent: Thursday, April 1, 2021 11:21 PM
> To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org
> Subject: [PATCH] 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.
> 
> Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
> ---

The patch is duplicated with 
http://patchwork.dpdk.org/project/dpdk/patch/20210317060219.2162370-1-qi.z.zhang@intel.com/
which already be applied.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-01 12:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-01 13:24 [dpdk-dev] [PATCH] net/ice: fix illegal pointer access in dev init Wenwu Ma
2021-04-01  2:37 ` Stephen Hemminger
2021-04-01 15:20 Wenwu Ma
2021-04-01 12:00 ` Zhang, Qi Z

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).