From: "Guilherme G. Piccoli" <gpicc...@linux.vnet.ibm.com> Date: Thu, 29 Sep 2016 13:24:08 -0300
> From: Milton Miller <milt...@us.ibm.com> > > While the driver is probing the adapter, an error may occur before the > netdev structure is allocated and attached to pci_dev. In this case, > not only netdev isn't available, but the tg3 private structure is also > not available as it is just math from the NULL pointer, so dereferences > must be skipped. > > The following trace is seen when the error is triggered: ... > This patch avoids the NULL pointer dereference by moving the access after > the netdev NULL pointer check on tg3_io_error_detected(). Also, we add a > check for netdev being NULL on tg3_io_resume() [suggested by Michael Chan]. > > Fixes: 0486a063b1ff ("tg3: prevent ifup/ifdown during PCI error recovery") > Fixes: dfc8f370316b ("net/tg3: Release IRQs on permanent error") > Tested-by: Guilherme G. Piccoli <gpicc...@linux.vnet.ibm.com> > Signed-off-by: Milton Miller <milt...@us.ibm.com> > Signed-off-by: Guilherme G. Piccoli <gpicc...@linux.vnet.ibm.com> > --- > > * v2 changelog: added netdev NULL check on tg3_io_resume() as per > Michael Chan's suggestion. Applied and queued up for -stable, thanks!