]> git.baikalelectronics.ru Git - kernel.git/commit
net: ena: fix race between link up and device initalization
authorArthur Kiyanovski <akiyano@amazon.com>
Mon, 11 Feb 2019 17:17:43 +0000 (19:17 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 12 Feb 2019 19:05:07 +0000 (14:05 -0500)
commit339c570f07ce328e68d573e8a741098d65971626
tree630370599a4219dc5bbd400c691ef39d71782030
parent5dfbd0aa1d60468ff1ef0962c95d40cb3bccd9c1
net: ena: fix race between link up and device initalization

Fix race condition between ena_update_on_link_change() and
ena_restore_device().

This race can occur if link notification arrives while the driver
is performing a reset sequence. In this case link can be set up,
enabling the device, before it is fully restored. If packets are
sent at this time, the driver might access uninitialized data
structures, causing kernel crash.

Move the clearing of ENA_FLAG_ONGOING_RESET and netif_carrier_on()
after ena_up() to ensure the device is ready when link is set up.

Fixes: cd191ceead55 ("net: ena: fix race condition between device reset and link up setup")
Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/amazon/ena/ena_netdev.c