ena module for Driver Update Program
CentOS Sources
2019-01-09 fc384122a7a805dde4dbbf3c4c4ef94a5ca0f2fe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Date: Tue, 30 Oct 2018 13:25:28 -0400
From: linville@redhat.com
To: rhkernel-list@redhat.com
Cc: Lin Liu <linl@redhat.com>
Subject: [RHEL7 13/28] net: ena: fix NULL dereference due to untimely napi
 initialization
 
From: "John W. Linville" <linville@redhat.com>
 
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1633418
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=18850510
 
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>
(cherry picked from commit 78a55d05def95144ca5fa9a64c49b2a0636a9866)
Signed-off-by: John W. Linville <linville@redhat.com>
---
 drivers/net/ethernet/amazon/ena/ena_netdev.c | 9 +++++++--
 1 file 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 b75537df9277..d7f050123f93 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -1568,8 +1568,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);
@@ -1723,6 +1721,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;
-- 
2.17.1