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

Yang, Qiming qiming.yang at intel.com
Thu Mar 18 03:07:27 CET 2021


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


More information about the dev mailing list