From: Igor Russkikh Date: Mon, 29 Apr 2019 08:20:19 +0000 (+0000) Subject: net/atlantic: check EEPROM dev address validity X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=99ceaad873059fd7a7ef4c8c5bf1575e64e880f9;p=dpdk.git net/atlantic: check EEPROM dev address validity Clients may not filling magic field, thus causing garbage to be passed as a device address. Limit that to maximum SMbus address. Fixes: ce4e8d418097 ("net/atlantic: implement EEPROM get/set") Cc: stable@dpdk.org Signed-off-by: Igor Russkikh --- diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index 988159683d..d7572734cb 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -1433,6 +1433,9 @@ int atl_dev_get_eeprom(struct rte_eth_dev *dev, eeprom->data == NULL) return -EINVAL; + if (eeprom->magic > 0x7F) + return -EINVAL; + if (eeprom->magic) dev_addr = eeprom->magic; @@ -1453,6 +1456,9 @@ int atl_dev_set_eeprom(struct rte_eth_dev *dev, eeprom->data == NULL) return -EINVAL; + if (eeprom->magic > 0x7F) + return -EINVAL; + if (eeprom->magic) dev_addr = eeprom->magic;