]> git.karo-electronics.de Git - karo-tx-linux.git/commit
cxgb4: avoid crash on PCI error recovery path
authorGuilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Mon, 29 May 2017 02:07:01 +0000 (23:07 -0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 30 May 2017 16:15:59 +0000 (12:15 -0400)
commit025d0973a0ec2121c6fd0da59e8cc3829fbb221e
tree0482b55e4fa37f08f8b8b8e3f44449a23afd2c9c
parent468b0df61a5146e79f63380ad6c36228fd30619c
cxgb4: avoid crash on PCI error recovery path

During PCI error recovery process, specifically on eeh_err_detected()
we might have a NULL netdev struct, hence a direct dereference will
lead to a kernel oops. This was observed with latest upstream kernel
(v4.12-rc2) on Chelsio adapter T422-CR in PowerPC machines.

This patch checks for NULL pointer and avoids the crash, both in
eeh_err_detected() and eeh_resume(). Also, we avoid to trigger
a fatal error or to try disabling interrupts on FW during PCI
error recovery, because: (a) driver might not be able to accurately
access PCI regions in this case, and (b) trigger a fatal error
_during_ the recovery steps is a mistake that could prevent the
recovery path to complete successfully.

Reported-by: Harsha Thyagaraja <hathyaga@in.ibm.com>
Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c