Skip to content

Commit

Permalink
bnx2x: Don't release PCI bars on shutdown
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Yuval Mintz <[email protected]>
Signed-off-by: Ariel Elior <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Yuval Mintz authored and davem330 committed Jan 16, 2014
1 parent a926592 commit d9aee59
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -12942,25 +12942,26 @@ static void __bnx2x_remove(struct pci_dev *pdev,
pci_set_power_state(pdev, PCI_D3hot);
}

if (bp->regview)
iounmap(bp->regview);
if (remove_netdev) {
if (bp->regview)
iounmap(bp->regview);

/* for vf doorbells are part of the regview and were unmapped along with
* it. FW is only loaded by PF.
*/
if (IS_PF(bp)) {
if (bp->doorbells)
iounmap(bp->doorbells);
/* For vfs, doorbells are part of the regview and were unmapped
* along with it. FW is only loaded by PF.
*/
if (IS_PF(bp)) {
if (bp->doorbells)
iounmap(bp->doorbells);

bnx2x_release_firmware(bp);
}
bnx2x_free_mem_bp(bp);
bnx2x_release_firmware(bp);
}
bnx2x_free_mem_bp(bp);

if (remove_netdev)
free_netdev(dev);

if (atomic_read(&pdev->enable_cnt) == 1)
pci_release_regions(pdev);
if (atomic_read(&pdev->enable_cnt) == 1)
pci_release_regions(pdev);
}

pci_disable_device(pdev);
}
Expand Down

0 comments on commit d9aee59

Please sign in to comment.