History

bnx2x: Don't release PCI bars on shutdown

The bnx2x driver in its pci shutdown() callback releases its pci bars (in the same manner it does during its pci remove() callback). During a system reboot while VFs are enabled, its possible for the VF's remove to be called (as a result of pci_disable_sriov()) after its shutdown callback has already finished running; This will cause a paging request fault as the VF tries to access the pci bar which it has previously released, crashing the system. This patch further differentiates the shutdown and remove callbacks, preventing the pci release procedures from being called during shutdown.

Yuval Mintz committed 12 years ago

Commit d9aee591 parent a9265921 file · +15 −14Browse files

Unified · Split

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c+15−14
@@ -12942,25 +12942,26 @@ static void __bnx2x_remove(struct pci_dev *pdev, · 12941 unmodified lines
1294212942 pci_set_power_state(pdev, PCI_D3hot);
1294312943 }
1294412944
12945− if (bp->regview)
12946− iounmap(bp->regview);
12945+ if (remove_netdev) {
12946+ if (bp->regview)
12947+ iounmap(bp->regview);
1294712948
12948− /* for vf doorbells are part of the regview and were unmapped along with
12949− * it. FW is only loaded by PF.
12950− */
12951− if (IS_PF(bp)) {
12952− if (bp->doorbells)
12953− iounmap(bp->doorbells);
12949+ /* For vfs, doorbells are part of the regview and were unmapped
12950+ * along with it. FW is only loaded by PF.
12951+ */
12952+ if (IS_PF(bp)) {
12953+ if (bp->doorbells)
12954+ iounmap(bp->doorbells);
1295412955
12955− bnx2x_release_firmware(bp);
12956− }
12957− bnx2x_free_mem_bp(bp);
12956+ bnx2x_release_firmware(bp);
12957+ }
12958+ bnx2x_free_mem_bp(bp);
1295812959
12959− if (remove_netdev)
1296012960 free_netdev(dev);
1296112961
12962− if (atomic_read(&pdev->enable_cnt) == 1)
12963− pci_release_regions(pdev);
12962+ if (atomic_read(&pdev->enable_cnt) == 1)
12963+ pci_release_regions(pdev);
12964+ }
1296412965
1296512966 pci_disable_device(pdev);
1296612967 }