Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1654035 > unrolled thread

[PATCH] netxen: Fix a sleep-in-atomic bug in netxen_nic_pci_mem_access_direct

Started byJia-Ju Bai <baijiaju1990@163.com>
First post2017-05-31 11:20 +0200
Last post2017-05-31 11:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] netxen: Fix a sleep-in-atomic bug in netxen_nic_pci_mem_access_direct Jia-Ju Bai <baijiaju1990@163.com> - 2017-05-31 11:20 +0200

#1654035 — [PATCH] netxen: Fix a sleep-in-atomic bug in netxen_nic_pci_mem_access_direct

FromJia-Ju Bai <baijiaju1990@163.com>
Date2017-05-31 11:20 +0200
Subject[PATCH] netxen: Fix a sleep-in-atomic bug in netxen_nic_pci_mem_access_direct
Message-ID<tN7Xk-2RF-9@gated-at.bofh.it>
The driver may sleep under a spin lock, and the function call path is:
netxen_nic_pci_mem_access_direct (acquire the lock by spin_lock)
  ioremap --> may sleep

To fix it, the lock is released before "ioremap", and the lock is 
acquired again after this function.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
---
 drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
index a996801..5ea553e 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c
@@ -1419,7 +1419,9 @@ static u32 netxen_nic_io_read_2M(struct netxen_adapter *adapter,
 
 		mem_base = pci_resource_start(adapter->pdev, 0) +
 					(start & PAGE_MASK);
+		spin_unlock(&adapter->ahw.mem_lock);
 		mem_ptr = ioremap(mem_base, PAGE_SIZE);
+		spin_lock(&adapter->ahw.mem_lock);
 		if (mem_ptr == NULL) {
 			ret = -EIO;
 			goto unlock;
-- 
1.7.9.5

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web