[SRU,XBC,1/3] net: ena: fix crash during failed resume from hibernation
diff mbox series

Message ID 20190220165559.23943-2-kamal@canonical.com
State New
Headers show
  • update ENA driver to 2.0.3K
Related show

Commit Message

Kamal Mostafa Feb. 20, 2019, 4:55 p.m. UTC
From: Arthur Kiyanovski <akiyano@amazon.com>

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

During resume from hibernation if ena_restore_device fails,
ena_com_dev_reset() is called, and uses the readless read mechanism,
which was already destroyed by the call to
ena_com_mmio_reg_read_request_destroy(). This causes a NULL pointer

In this commit we switch the call order of the above two functions
to avoid this crash.

Fixes: d7703ddbd7c9 ("net: ena: fix rare bug when failed restart/resume is followed by driver removal")
Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit e76ad21d070f79e566ac46ce0b0584c3c93e1b43)
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
 drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff mbox series

diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index 89e1a565f3f3..05a27496c224 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -2697,8 +2697,8 @@  static int ena_restore_device(struct ena_adapter *adapter)
-	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);
 	clear_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags);
 	clear_bit(ENA_FLAG_ONGOING_RESET, &adapter->flags);