Commit e5ec3324 authored by Netanel Belgazal's avatar Netanel Belgazal Committed by Kleber Sacilotto de Souza

net: ena: fix surprise unplug NULL dereference kernel crash

BugLink: http://bugs.launchpad.net/bugs/1792044

Starting with driver version 1.5.0, in case of a surprise device
unplug, there is a race caused by invoking ena_destroy_device()
from two different places. As a result, the readless register might
be accessed after it was destroyed.
Signed-off-by: default avatarNetanel Belgazal <netanel@amazon.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
(cherry picked from commit 772ed869 linux-next)
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
Acked-by: default avatarAcked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: default avatarBrad Figg <brad.figg@canonical.com>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent 04bca928
...@@ -3421,12 +3421,12 @@ static void ena_remove(struct pci_dev *pdev) ...@@ -3421,12 +3421,12 @@ static void ena_remove(struct pci_dev *pdev)
netdev->rx_cpu_rmap = NULL; netdev->rx_cpu_rmap = NULL;
} }
#endif /* CONFIG_RFS_ACCEL */ #endif /* CONFIG_RFS_ACCEL */
unregister_netdev(netdev);
del_timer_sync(&adapter->timer_service); del_timer_sync(&adapter->timer_service);
cancel_work_sync(&adapter->reset_task); cancel_work_sync(&adapter->reset_task);
unregister_netdev(netdev);
/* Reset the device only if the device is running. */ /* Reset the device only if the device is running. */
if (test_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags)) if (test_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags))
ena_com_dev_reset(ena_dev, adapter->reset_reason); ena_com_dev_reset(ena_dev, adapter->reset_reason);
......
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