]> 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)
commit2cca28a157e6f4491be76a7efdb0646cf0278ee2
tree630370599a4219dc5bbd400c691ef39d71782030
parent0e3f707dd52aee88f6f20e0cacd0363e6a7cf1bc
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: b778d11c69d3 ("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