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
56
57
58
59
60
61
62
63
Date: Tue, 30 Oct 2018 13:25:22 -0400
From: linville@redhat.com
To: rhkernel-list@redhat.com
Cc: Lin Liu <linl@redhat.com>
Subject: [RHEL7 07/28] net: ena: fix missing lock during device destruction
 
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
 
acquire the rtnl_lock during device destruction to avoid
using partially destroyed device.
 
ena_remove() shares almost the same logic as ena_destroy_device(),
so use ena_destroy_device() and avoid duplications.
 
Signed-off-by: Netanel Belgazal <netanel@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 944b28aa2982b4590d4d4dfc777cf85135dca2c0)
Signed-off-by: John W. Linville <linville@redhat.com>
---
 drivers/net/ethernet/amazon/ena/ena_netdev.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
 
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index 41e59e5db064..9497db03bec8 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -3441,24 +3441,18 @@ static void ena_remove(struct pci_dev *pdev)
 
     unregister_netdev(netdev);
 
-    /* Reset the device only if the device is running. */
+    /* If the device is running then we want to make sure the device will be
+     * reset to make sure no more events will be issued by the device.
+     */
     if (test_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags))
-        ena_com_dev_reset(ena_dev, adapter->reset_reason);
-
-    ena_free_mgmnt_irq(adapter);
+        set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags);
 
-    ena_disable_msix(adapter);
+    rtnl_lock();
+    ena_destroy_device(adapter, true);
+    rtnl_unlock();
 
     free_netdev(netdev);
 
-    ena_com_mmio_reg_read_request_destroy(ena_dev);
-
-    ena_com_abort_admin_commands(ena_dev);
-
-    ena_com_wait_for_abort_completion(ena_dev);
-
-    ena_com_admin_destroy(ena_dev);
-
     ena_com_rss_destroy(ena_dev);
 
     ena_com_delete_debug_area(ena_dev);
-- 
2.17.1