summaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorShay Agroskin <shayagr@amazon.com>2020-08-19 19:28:36 +0200
committerDavid S. Miller <davem@davemloft.net>2020-08-20 00:32:57 +0200
commit63d4a4c145cca2e84dc6e62d2ef5cb990c9723c2 (patch)
tree187b11fa702e22187f5ca7f4f760f318fd490ff8 /virt
parentnet: ipv4: remove duplicate "the the" phrase in Kconfig text (diff)
downloadlinux-63d4a4c145cca2e84dc6e62d2ef5cb990c9723c2.tar.xz
linux-63d4a4c145cca2e84dc6e62d2ef5cb990c9723c2.zip
net: ena: Prevent reset after device destruction
The reset work is scheduled by the timer routine whenever it detects that a device reset is required (e.g. when a keep_alive signal is missing). When releasing device resources in ena_destroy_device() the driver cancels the scheduling of the timer routine without destroying the reset work explicitly. This creates the following bug: The driver is suspended and the ena_suspend() function is called -> This function calls ena_destroy_device() to free the net device resources -> The driver waits for the timer routine to finish its execution and then cancels it, thus preventing from it to be called again. If, in its final execution, the timer routine schedules a reset, the reset routine might be called afterwards,and a redundant call to ena_restore_device() would be made. By changing the reset routine we allow it to read the device's state accurately. This is achieved by checking whether ENA_FLAG_TRIGGER_RESET flag is set before resetting the device and making both the destruction function and the flag check are under rtnl lock. The ENA_FLAG_TRIGGER_RESET is cleared at the end of the destruction routine. Also surround the flag check with 'likely' because we expect that the reset routine would be called only when ENA_FLAG_TRIGGER_RESET flag is set. The destruction of the timer and reset services in __ena_shutoff() have to stay, even though the timer routine is destroyed in ena_destroy_device(). This is to avoid a case in which the reset routine is scheduled after free_netdev() in __ena_shutoff(), which would create an access to freed memory in adapter->flags. Fixes: 8c5c7abdeb2d ("net: ena: add power management ops to the ENA driver") Signed-off-by: Shay Agroskin <shayagr@amazon.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'virt')
0 files changed, 0 insertions, 0 deletions