Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1732437

[PATCH for 4.9 18/59] igb: re-assign hw address pointer on reset after PCI error

From "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>
Newsgroups linux.kernel
Subject [PATCH for 4.9 18/59] igb: re-assign hw address pointer on reset after PCI error
Date 2017-09-14 18:30 +0200
Message-ID <upFbB-7nG-29@gated-at.bofh.it> (permalink)
References <upEIx-6V9-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Guilherme G Piccoli <gpiccoli@linux.vnet.ibm.com>

[ Upstream commit 69b97cf6dbce7403845a28bbc75d57f5be7b12ac ]

Whenever the igb driver detects the result of a read operation returns
a value composed only by F's (like 0xFFFFFFFF), it will detach the
net_device, clear the hw_addr pointer and warn to the user that adapter's
link is lost - those steps happen on igb_rd32().

In case a PCI error happens on Power architecture, there's a recovery
mechanism called EEH, that will reset the PCI slot and call driver's
handlers to reset the adapter and network functionality as well.

We observed that once hw_addr is NULL after the error is detected on
igb_rd32(), it's never assigned back, so in the process of resetting
the network functionality we got a NULL pointer dereference in both
igb_configure_tx_ring() and igb_configure_rx_ring(). In order to avoid
such bug, this patch re-assigns the hw_addr value in the slot_reset
handler.

Reported-by: Anthony H Thai <ahthai@us.ibm.com>
Reported-by: Harsha Thyagaraja <hathyaga@in.ibm.com>
Signed-off-by: Guilherme G Piccoli <gpiccoli@linux.vnet.ibm.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 drivers/net/ethernet/intel/igb/igb_main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 9affd7c198bd..6a62447fe377 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -7882,6 +7882,11 @@ static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev)
 		pci_enable_wake(pdev, PCI_D3hot, 0);
 		pci_enable_wake(pdev, PCI_D3cold, 0);
 
+		/* In case of PCI error, adapter lose its HW address
+		 * so we should re-assign it here.
+		 */
+		hw->hw_addr = adapter->io_addr;
+
 		igb_reset(adapter);
 		wr32(E1000_WUS, ~0);
 		result = PCI_ERS_RESULT_RECOVERED;
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH for 4.9 01/59] drm_fourcc: Fix DRM_FORMAT_MOD_LINEAR #define "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-14 18:30 +0200
  [PATCH for 4.9 12/59] MIPS: kexec: Do not reserve invalid crashkernel  memory on boot "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-14 18:30 +0200
  [PATCH for 4.9 20/59] reset: ti_syscon: fix a ti_syscon_reset_status  issue "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-14 18:30 +0200
  [PATCH for 4.9 04/59] drm/i915: Fix the overlay frontbuffer tracking "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-14 18:30 +0200
  [PATCH for 4.9 24/59] usb: make the MTK XHCI driver compile for older  MIPS SoCs "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-14 18:30 +0200
  [PATCH for 4.9 18/59] igb: re-assign hw address pointer on reset  after PCI error "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-14 18:30 +0200
  [PATCH for 4.9 19/59] extcon: axp288: Use vbus-valid instead of  -present to determine cable presence "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-14 18:30 +0200
  [PATCH for 4.9 15/59] power: supply: axp288_fuel_gauge: Fix  fuel_gauge_reg_readb return on error "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-14 18:30 +0200
  [PATCH for 4.9 11/59] MIPS: fix mem=X@Y commandline processing "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-14 18:30 +0200
    Re: [PATCH for 4.9 11/59] MIPS: fix mem=X@Y commandline processing Mathieu Malaterre <malat@debian.org> - 2017-09-14 21:00 +0200
      Re: [PATCH for 4.9 11/59] MIPS: fix mem=X@Y commandline processing "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-14 21:20 +0200
        Re: [PATCH for 4.9 11/59] MIPS: fix mem=X@Y commandline processing Mathieu Malaterre <malat@debian.org> - 2017-09-14 21:20 +0200
          Re: [PATCH for 4.9 11/59] MIPS: fix mem=X@Y commandline processing Marcin Nowakowski <marcin.nowakowski@imgtec.com> - 2017-09-15 07:50 +0200
            Re: [PATCH for 4.9 11/59] MIPS: fix mem=X@Y commandline processing Paul Burton <paul.burton@imgtec.com> - 2017-09-15 19:10 +0200
  [PATCH for 4.9 08/59] RDS: RDMA: Fix the composite message user  notification "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-14 18:30 +0200
  [PATCH for 4.9 23/59] clk: wm831x: fix usleep_range with bad range "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-14 18:30 +0200
  [PATCH for 4.9 16/59] scsi: be2iscsi: Add checks to validate CID  alloc/free "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-14 18:30 +0200
  [PATCH for 4.9 22/59] clk/axs10x: Clear init field in driver probe "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-14 18:30 +0200
  [PATCH for 4.9 17/59] ARM: dts: am335x-chilisom: Wakeup from RTC-only  state by power on event "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-14 18:30 +0200
  [PATCH for 4.9 21/59] sh_eth: use correct name for ECMR_MPDE bit "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-09-14 18:30 +0200

csiph-web