Skip to content

Commit

Permalink
lan78xx: Allow EEPROM write for less than MAX_EEPROM_SIZE
Browse files Browse the repository at this point in the history
Allow EEPROM write for less than MAX_EEPROM_SIZE

Fixes: 55d7de9 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
Signed-off-by: Nisar Sayed <Nisar.Sayed@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Nisar Sayed authored and David S. Miller committed Sep 21, 2017
1 parent 8a7ffeb commit c077682
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/net/usb/lan78xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1290,11 +1290,10 @@ static int lan78xx_ethtool_set_eeprom(struct net_device *netdev,
if (ret)
return ret;

/* Allow entire eeprom update only */
if ((ee->magic == LAN78XX_EEPROM_MAGIC) &&
(ee->offset == 0) &&
(ee->len == 512) &&
(data[0] == EEPROM_INDICATOR))
/* Invalid EEPROM_INDICATOR at offset zero will result in a failure
* to load data from EEPROM
*/
if (ee->magic == LAN78XX_EEPROM_MAGIC)
ret = lan78xx_write_raw_eeprom(dev, ee->offset, ee->len, data);
else if ((ee->magic == LAN78XX_OTP_MAGIC) &&
(ee->offset == 0) &&
Expand Down

0 comments on commit c077682

Please sign in to comment.