Skip to content

Commit

Permalink
net: ena: fix surprise unplug NULL dereference kernel crash
Browse files Browse the repository at this point in the history
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: Netanel Belgazal <netanel@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Netanel Belgazal authored and David S. Miller committed Sep 9, 2018
1 parent 5cf4a85 commit 772ed86
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/amazon/ena/ena_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -3409,12 +3409,12 @@ static void ena_remove(struct pci_dev *pdev)
netdev->rx_cpu_rmap = NULL;
}
#endif /* CONFIG_RFS_ACCEL */

unregister_netdev(netdev);
del_timer_sync(&adapter->timer_service);

cancel_work_sync(&adapter->reset_task);

unregister_netdev(netdev);

/* Reset the device only if the device is running. */
if (test_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags))
ena_com_dev_reset(ena_dev, adapter->reset_reason);
Expand Down

0 comments on commit 772ed86

Please sign in to comment.