summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorArthur Kiyanovski <akiyano@amazon.com>2018-10-09 11:21:29 +0300
committerDavid S. Miller <davem@davemloft.net>2018-10-09 20:49:49 +0300
commit78a55d05def95144ca5fa9a64c49b2a0636a9866 (patch)
tree7bb860bc8cb7773d60144904df956a0ee59ebf4e /drivers
parentd7703ddbd7c9cb1ab7c08e1b85b314ff8cea38e9 (diff)
downloadlinux-78a55d05def95144ca5fa9a64c49b2a0636a9866.tar.xz
net: ena: fix NULL dereference due to untimely napi initialization
napi poll functions should be initialized before running request_irq(), to handle a rare condition where there is a pending interrupt, causing the ISR to fire immediately while the poll function wasn't set yet, causing a NULL dereference. Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)") Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/amazon/ena/ena_netdev.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index ce18e07ff5ad..d906293ce07d 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -1575,8 +1575,6 @@ static int ena_up_complete(struct ena_adapter *adapter)
if (rc)
return rc;
- ena_init_napi(adapter);
-
ena_change_mtu(adapter->netdev, adapter->netdev->mtu);
ena_refill_all_rx_bufs(adapter);
@@ -1730,6 +1728,13 @@ static int ena_up(struct ena_adapter *adapter)
ena_setup_io_intr(adapter);
+ /* napi poll functions should be initialized before running
+ * request_irq(), to handle a rare condition where there is a pending
+ * interrupt, causing the ISR to fire immediately while the poll
+ * function wasn't set yet, causing a null dereference
+ */
+ ena_init_napi(adapter);
+
rc = ena_request_io_irq(adapter);
if (rc)
goto err_req_irq;