Commit dbb01c8a authored by Mitch Williams's avatar Mitch Williams Committed by David S. Miller

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: default avatarMitch Williams <mitch.a.williams@intel.com>
Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: default avatarSibai Li <sibai.li@intel.com>
Signed-off-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ed1f5b58
...@@ -215,6 +215,9 @@ static void i40evf_irq_disable(struct i40evf_adapter *adapter) ...@@ -215,6 +215,9 @@ static void i40evf_irq_disable(struct i40evf_adapter *adapter)
int i; int i;
struct i40e_hw *hw = &adapter->hw; struct i40e_hw *hw = &adapter->hw;
if (!adapter->msix_entries)
return;
for (i = 1; i < adapter->num_msix_vectors; i++) { for (i = 1; i < adapter->num_msix_vectors; i++) {
wr32(hw, I40E_VFINT_DYN_CTLN1(i - 1), 0); wr32(hw, I40E_VFINT_DYN_CTLN1(i - 1), 0);
synchronize_irq(adapter->msix_entries[i].vector); synchronize_irq(adapter->msix_entries[i].vector);
...@@ -2372,17 +2375,15 @@ static void i40evf_remove(struct pci_dev *pdev) ...@@ -2372,17 +2375,15 @@ static void i40evf_remove(struct pci_dev *pdev)
} }
adapter->state = __I40EVF_REMOVE; adapter->state = __I40EVF_REMOVE;
if (adapter->num_msix_vectors) { if (adapter->msix_entries) {
i40evf_misc_irq_disable(adapter); i40evf_misc_irq_disable(adapter);
del_timer_sync(&adapter->watchdog_timer);
flush_scheduled_work();
i40evf_free_misc_irq(adapter); i40evf_free_misc_irq(adapter);
i40evf_reset_interrupt_capability(adapter); i40evf_reset_interrupt_capability(adapter);
} }
del_timer_sync(&adapter->watchdog_timer);
flush_scheduled_work();
if (hw->aq.asq.count) if (hw->aq.asq.count)
i40evf_shutdown_adminq(hw); i40evf_shutdown_adminq(hw);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment