i40evf: fix multiple crashes on remove

Depending upon the state of the driver, there are several potential
pitfalls on remove. Kill the watchdog task so rmmod doesn't hang.
Check the adapter->msix_entries field, not the num_msix_vectors field,
which is never cleared.

Change-ID: I0546048477f09fc19e481bd37efa30daae4faa88
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Mitch Williams 2014-02-20 19:29:07 -08:00 committed by David S. Miller
parent ed1f5b58ea
commit dbb01c8aa0
1 changed files with 7 additions and 6 deletions

View File

@ -215,6 +215,9 @@ static void i40evf_irq_disable(struct i40evf_adapter *adapter)
int i;
struct i40e_hw *hw = &adapter->hw;
if (!adapter->msix_entries)
return;
for (i = 1; i < adapter->num_msix_vectors; i++) {
wr32(hw, I40E_VFINT_DYN_CTLN1(i - 1), 0);
synchronize_irq(adapter->msix_entries[i].vector);
@ -2372,17 +2375,15 @@ static void i40evf_remove(struct pci_dev *pdev)
}
adapter->state = __I40EVF_REMOVE;
if (adapter->num_msix_vectors) {
if (adapter->msix_entries) {
i40evf_misc_irq_disable(adapter);
del_timer_sync(&adapter->watchdog_timer);
flush_scheduled_work();
i40evf_free_misc_irq(adapter);
i40evf_reset_interrupt_capability(adapter);
}
del_timer_sync(&adapter->watchdog_timer);
flush_scheduled_work();
if (hw->aq.asq.count)
i40evf_shutdown_adminq(hw);