Commit 1e4c32f3 authored by Jacob Keller's avatar Jacob Keller Committed by Jeff Kirsher

fm10k: prevent RCU issues during AER events

During an AER action response, we were calling fm10k_close without
holding the rtnl_lock() which could lead to possible RCU warnings being
produced due to 64bit stat updates among other causes. Similarly, we
need rtnl_lock() around fm10k_open during fm10k_io_resume. Follow the
same pattern elsewhere in the driver and protect the entire open/close
sequence.
Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Tested-by: default avatarKrishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 2d0f76be
...@@ -2271,6 +2271,8 @@ static pci_ers_result_t fm10k_io_error_detected(struct pci_dev *pdev, ...@@ -2271,6 +2271,8 @@ static pci_ers_result_t fm10k_io_error_detected(struct pci_dev *pdev,
if (state == pci_channel_io_perm_failure) if (state == pci_channel_io_perm_failure)
return PCI_ERS_RESULT_DISCONNECT; return PCI_ERS_RESULT_DISCONNECT;
rtnl_lock();
if (netif_running(netdev)) if (netif_running(netdev))
fm10k_close(netdev); fm10k_close(netdev);
...@@ -2279,6 +2281,8 @@ static pci_ers_result_t fm10k_io_error_detected(struct pci_dev *pdev, ...@@ -2279,6 +2281,8 @@ static pci_ers_result_t fm10k_io_error_detected(struct pci_dev *pdev,
/* free interrupts */ /* free interrupts */
fm10k_clear_queueing_scheme(interface); fm10k_clear_queueing_scheme(interface);
rtnl_unlock();
pci_disable_device(pdev); pci_disable_device(pdev);
/* Request a slot reset. */ /* Request a slot reset. */
...@@ -2349,11 +2353,13 @@ static void fm10k_io_resume(struct pci_dev *pdev) ...@@ -2349,11 +2353,13 @@ static void fm10k_io_resume(struct pci_dev *pdev)
/* reset statistics starting values */ /* reset statistics starting values */
hw->mac.ops.rebind_hw_stats(hw, &interface->stats); hw->mac.ops.rebind_hw_stats(hw, &interface->stats);
rtnl_lock();
err = fm10k_init_queueing_scheme(interface); err = fm10k_init_queueing_scheme(interface);
if (err) { if (err) {
dev_err(&interface->pdev->dev, dev_err(&interface->pdev->dev,
"init_queueing_scheme failed: %d\n", err); "init_queueing_scheme failed: %d\n", err);
return; goto unlock;
} }
/* reassociate interrupts */ /* reassociate interrupts */
...@@ -2370,6 +2376,9 @@ static void fm10k_io_resume(struct pci_dev *pdev) ...@@ -2370,6 +2376,9 @@ static void fm10k_io_resume(struct pci_dev *pdev)
if (!err) if (!err)
netif_device_attach(netdev); netif_device_attach(netdev);
unlock:
rtnl_unlock();
} }
static const struct pci_error_handlers fm10k_err_handler = { static const struct pci_error_handlers fm10k_err_handler = {
......
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