]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
UBUNTU: SAUCE: net: ena: fix crash during ena_remove()
authorArthur Kiyanovski <akiyano@amazon.com>
Thu, 8 Nov 2018 18:37:58 +0000 (10:37 -0800)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fri, 9 Nov 2018 19:01:07 +0000 (17:01 -0200)
commite14628938907fa4e81507875515917e64a0c7311
tree5390f30105c81124ed113e79ccbe83b9ccfd0418
parentb9e7b8a08ee4ea8bd1ddf6d845377ef108eb01b6
UBUNTU: SAUCE: net: ena: fix crash during ena_remove()

BugLink: http://bugs.launchpad.net/bugs/1802341
In ena_remove() we have the following stack call:
ena_remove()
  unregister_netdev()
  ena_destroy_device()
    netif_carrier_off()

Calling netif_carrier_off() causes linkwatch to try to handle the
link change event on the already unregistered netdev, which leads
to a read from an unreadable memory address.

This patch switches the order of the two functions, so that
netif_carrier_off() is called on a regiestered netdev.

To accomplish this fix we also had to:
1. Remove the set bit ENA_FLAG_TRIGGER_RESET
2. Add a sanitiy check in ena_close()
both to prevent double device reset (when calling unregister_netdev()
ena_close is called, but the device was already deleted in
ena_destroy_device()).
3. Set the admin_queue running state to false to avoid using it after
device was reset (for example when calling ena_destroy_all_io_queues()
right after ena_com_dev_reset() in ena_down)

Finally, driver version is also updated.

Change-Id: I3cc1aafe9cb3701a6eaee44e00add0e175c93148

Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Acked-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/net/ethernet/amazon/ena/ena_netdev.c
drivers/net/ethernet/amazon/ena/ena_netdev.h