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 <igor.russkikh@aquantia.com>
This commit is contained in:
Igor Russkikh 2019-04-29 08:20:19 +00:00 committed by Ferruh Yigit
parent d1093f66a8
commit 99ceaad873

View File

@ -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;