Commit 772ed869 authored by Netanel Belgazal's avatar Netanel Belgazal Committed by David S. Miller

net: ena: fix surprise unplug NULL dereference kernel crash

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>
parent 5cf4a853
...@@ -3409,12 +3409,12 @@ static void ena_remove(struct pci_dev *pdev) ...@@ -3409,12 +3409,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