diff options
| author | Aleksandr Loktionov <aleksandr.loktionov@intel.com> | 2023-04-25 17:44:14 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-06-21 15:59:18 +0200 |
| commit | 10e1e07bdea4b101f9d5e988a57f8573fc9df4ef (patch) | |
| tree | 8028c317f89921d1adeefb7ce60df11194be4893 | |
| parent | fe03fd373ca6da92d3112b7e52144114278e2129 (diff) | |
| download | linux-10e1e07bdea4b101f9d5e988a57f8573fc9df4ef.tar.gz linux-10e1e07bdea4b101f9d5e988a57f8573fc9df4ef.tar.bz2 linux-10e1e07bdea4b101f9d5e988a57f8573fc9df4ef.zip | |
igb: fix nvm.ops.read() error handling
[ Upstream commit 48a821fd58837800750ec1b3962f0f799630a844 ]
Add error handling into igb_set_eeprom() function, in case
nvm.ops.read() fails just quit with error code asap.
Fixes: 9d5c824399de ("igb: PCI-Express 82575 Gigabit Ethernet driver")
Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
| -rw-r--r-- | drivers/net/ethernet/intel/igb/igb_ethtool.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index e99e6e44b525..b2f46004a3d0 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c @@ -822,6 +822,8 @@ static int igb_set_eeprom(struct net_device *netdev, */ ret_val = hw->nvm.ops.read(hw, last_word, 1, &eeprom_buff[last_word - first_word]); + if (ret_val) + goto out; } /* Device's eeprom is always little-endian, word addressable */ @@ -841,6 +843,7 @@ static int igb_set_eeprom(struct net_device *netdev, hw->nvm.ops.update(hw); igb_set_fw_version(adapter); +out: kfree(eeprom_buff); return ret_val; } |
