Skip to content

Commit

Permalink
Merge branch 'ena-hibernation-and-rmmod-bug-fixes'
Browse files Browse the repository at this point in the history
Arthur Kiyanovski says:

====================
net: ena: hibernation and rmmod bug fixes

This patchset includes 2 bug fixes:
1. A fix to a crash during resume from hibernation.
2. A fix to an illegal memory access during driver removal (e.g. during rmmod)
   which might cause a crash in certain systems.

The subminor number in the driver version is also promoted to indicate driver
was changed.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Nov 19, 2018
2 parents e1e4647 + 4c23738 commit d7c6021
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
23 changes: 11 additions & 12 deletions drivers/net/ethernet/amazon/ena/ena_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1848,6 +1848,8 @@ static void ena_down(struct ena_adapter *adapter)
rc = ena_com_dev_reset(adapter->ena_dev, adapter->reset_reason);
if (rc)
dev_err(&adapter->pdev->dev, "Device reset failed\n");
/* stop submitting admin commands on a device that was reset */
ena_com_set_admin_running_state(adapter->ena_dev, false);
}

ena_destroy_all_io_queues(adapter);
Expand Down Expand Up @@ -1914,6 +1916,9 @@ static int ena_close(struct net_device *netdev)

netif_dbg(adapter, ifdown, netdev, "%s\n", __func__);

if (!test_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags))
return 0;

if (test_bit(ENA_FLAG_DEV_UP, &adapter->flags))
ena_down(adapter);

Expand Down Expand Up @@ -2613,9 +2618,7 @@ static void ena_destroy_device(struct ena_adapter *adapter, bool graceful)
ena_down(adapter);

/* Stop the device from sending AENQ events (in case reset flag is set
* and device is up, ena_close already reset the device
* In case the reset flag is set and the device is up, ena_down()
* already perform the reset, so it can be skipped.
* and device is up, ena_down() already reset the device.
*/
if (!(test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags) && dev_up))
ena_com_dev_reset(adapter->ena_dev, adapter->reset_reason);
Expand Down Expand Up @@ -2694,8 +2697,8 @@ static int ena_restore_device(struct ena_adapter *adapter)
ena_com_abort_admin_commands(ena_dev);
ena_com_wait_for_abort_completion(ena_dev);
ena_com_admin_destroy(ena_dev);
ena_com_mmio_reg_read_request_destroy(ena_dev);
ena_com_dev_reset(ena_dev, ENA_REGS_RESET_DRIVER_INVALID_STATE);
ena_com_mmio_reg_read_request_destroy(ena_dev);
err:
clear_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags);
clear_bit(ENA_FLAG_ONGOING_RESET, &adapter->flags);
Expand Down Expand Up @@ -3452,6 +3455,8 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
ena_com_rss_destroy(ena_dev);
err_free_msix:
ena_com_dev_reset(ena_dev, ENA_REGS_RESET_INIT_ERR);
/* stop submitting admin commands on a device that was reset */
ena_com_set_admin_running_state(ena_dev, false);
ena_free_mgmnt_irq(adapter);
ena_disable_msix(adapter);
err_worker_destroy:
Expand Down Expand Up @@ -3498,18 +3503,12 @@ static void ena_remove(struct pci_dev *pdev)

cancel_work_sync(&adapter->reset_task);

unregister_netdev(netdev);

/* If the device is running then we want to make sure the device will be
* reset to make sure no more events will be issued by the device.
*/
if (test_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags))
set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags);

rtnl_lock();
ena_destroy_device(adapter, true);
rtnl_unlock();

unregister_netdev(netdev);

free_netdev(netdev);

ena_com_rss_destroy(ena_dev);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/amazon/ena/ena_netdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

#define DRV_MODULE_VER_MAJOR 2
#define DRV_MODULE_VER_MINOR 0
#define DRV_MODULE_VER_SUBMINOR 1
#define DRV_MODULE_VER_SUBMINOR 2

#define DRV_MODULE_NAME "ena"
#ifndef DRV_MODULE_VERSION
Expand Down

0 comments on commit d7c6021

Please sign in to comment.