mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-20 14:16:02 +00:00
e1000e: don't return half-read eeprom on error
On a read error, e1000e might have returned uninitialized block of eeprom data back to userspace. The convention is that 0xff is "empty", so mark the entire eeprom as empty in case of an error. Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
This commit is contained in:
parent
e410553fd3
commit
f227ec3ca2
1 changed files with 5 additions and 1 deletions
|
@ -494,10 +494,14 @@ static int e1000_get_eeprom(struct net_device *netdev,
|
|||
for (i = 0; i < last_word - first_word + 1; i++) {
|
||||
ret_val = e1000_read_nvm(hw, first_word + i, 1,
|
||||
&eeprom_buff[i]);
|
||||
if (ret_val)
|
||||
if (ret_val) {
|
||||
/* a read error occurred, throw away the
|
||||
* result */
|
||||
memset(eeprom_buff, 0xff, sizeof(eeprom_buff));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Device's eeprom is always little-endian, word addressable */
|
||||
for (i = 0; i < last_word - first_word + 1; i++)
|
||||
|
|
Loading…
Reference in a new issue