net: ena: fix crash during failed resume from hibernation
authorArthur Kiyanovski <akiyano@amazon.com>
Mon, 19 Nov 2018 10:05:20 +0000 (12:05 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Dec 2018 08:16:13 +0000 (09:16 +0100)
commit4a9ad460a07b2fcbe071fb33df5b79b12dc4ca61
treea98c7add084326ac5f90bac81d0495f7e234a184
parentd7dace92d0402d2c64d2486b93f8b655a87f33b2
net: ena: fix crash during failed resume from hibernation

[ Upstream commit e76ad21d070f79e566ac46ce0b0584c3c93e1b43 ]

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
reference.

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/amazon/ena/ena_netdev.c