From 99ceaad873059fd7a7ef4c8c5bf1575e64e880f9 Mon Sep 17 00:00:00 2001 From: Igor Russkikh Date: Mon, 29 Apr 2019 08:20:19 +0000 Subject: [PATCH] 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 --- drivers/net/atlantic/atl_ethdev.c | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- 2.20.1