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:
parent
d1093f66a8
commit
99ceaad873
@ -1433,6 +1433,9 @@ int atl_dev_get_eeprom(struct rte_eth_dev *dev,
|
|||||||
eeprom->data == NULL)
|
eeprom->data == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (eeprom->magic > 0x7F)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
if (eeprom->magic)
|
if (eeprom->magic)
|
||||||
dev_addr = eeprom->magic;
|
dev_addr = eeprom->magic;
|
||||||
|
|
||||||
@ -1453,6 +1456,9 @@ int atl_dev_set_eeprom(struct rte_eth_dev *dev,
|
|||||||
eeprom->data == NULL)
|
eeprom->data == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (eeprom->magic > 0x7F)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
if (eeprom->magic)
|
if (eeprom->magic)
|
||||||
dev_addr = eeprom->magic;
|
dev_addr = eeprom->magic;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user