patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/ice/base: fix out of memory bound for MAC addresses
@ 2021-03-17  6:02 Qi Zhang
  2021-03-18  2:07 ` Yang, Qiming
  0 siblings, 1 reply; 3+ messages in thread
From: Qi Zhang @ 2021-03-17  6:02 UTC (permalink / raw)
  To: qiming.yang; +Cc: dev, ferruh.yigit, Qi Zhang, stable

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 <ferruh.yigit@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 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


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

* Re: [dpdk-stable] [PATCH] net/ice/base: fix out of memory bound for MAC addresses
  2021-03-17  6:02 [dpdk-stable] [PATCH] net/ice/base: fix out of memory bound for MAC addresses Qi Zhang
@ 2021-03-18  2:07 ` Yang, Qiming
  2021-03-24 13:03   ` Zhang, Qi Z
  0 siblings, 1 reply; 3+ messages in thread
From: Yang, Qiming @ 2021-03-18  2:07 UTC (permalink / raw)
  To: Zhang, Qi Z; +Cc: dev, Yigit, Ferruh, stable


> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Wednesday, March 17, 2021 14:02
> To: Yang, Qiming <qiming.yang@intel.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; 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 <ferruh.yigit@intel.com>
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> ---
>  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 <qiming.yang@intel.com>

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

* Re: [dpdk-stable] [PATCH] net/ice/base: fix out of memory bound for MAC addresses
  2021-03-18  2:07 ` Yang, Qiming
@ 2021-03-24 13:03   ` Zhang, Qi Z
  0 siblings, 0 replies; 3+ messages in thread
From: Zhang, Qi Z @ 2021-03-24 13:03 UTC (permalink / raw)
  To: Yang, Qiming; +Cc: dev, Yigit, Ferruh, stable



> -----Original Message-----
> From: Yang, Qiming <qiming.yang@intel.com>
> Sent: Thursday, March 18, 2021 10:07 AM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; stable@dpdk.org
> Subject: RE: [PATCH] net/ice/base: fix out of memory bound for MAC
> addresses
> 
> 
> > -----Original Message-----
> > From: Zhang, Qi Z <qi.z.zhang@intel.com>
> > Sent: Wednesday, March 17, 2021 14:02
> > To: Yang, Qiming <qiming.yang@intel.com>
> > Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Zhang, Qi Z
> > <qi.z.zhang@intel.com>; 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 <ferruh.yigit@intel.com>
> > Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> > ---
> >  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 <qiming.yang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi


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

end of thread, other threads:[~2021-03-24 13:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-17  6:02 [dpdk-stable] [PATCH] net/ice/base: fix out of memory bound for MAC addresses Qi Zhang
2021-03-18  2:07 ` Yang, Qiming
2021-03-24 13:03   ` 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).