linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netxen: Fix a sleep-in-atomic bug in netxen_nic_pci_mem_access_direct
@ 2017-06-19  2:48 Jia-Ju Bai
  2017-06-20 17:35 ` David Miller
  0 siblings, 1 reply; 10+ messages in thread
From: Jia-Ju Bai @ 2017-06-19  2:48 UTC (permalink / raw)
  To: manish.chopra, rahul.verma, davem; +Cc: netdev, linux-kernel, Jia-Ju Bai

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

^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH] netxen: Fix a sleep-in-atomic bug in netxen_nic_pci_mem_access_direct
@ 2017-05-31  9:21 Jia-Ju Bai
  0 siblings, 0 replies; 10+ messages in thread
From: Jia-Ju Bai @ 2017-05-31  9:21 UTC (permalink / raw)
  To: manish.chopra, rahul.verma, Dept-GELinuxNICDev
  Cc: netdev, linux-kernel, Jia-Ju Bai

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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-06-22 10:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-19  2:48 [PATCH] netxen: Fix a sleep-in-atomic bug in netxen_nic_pci_mem_access_direct Jia-Ju Bai
2017-06-20 17:35 ` David Miller
2017-06-21  6:11   ` Kalle Valo
2017-06-21  6:33     ` Jia-Ju Bai
2017-06-21 13:40       ` Kalle Valo
2017-06-21 14:32         ` Jia-Ju Bai
2017-06-22  6:08         ` Dan Carpenter
2017-06-22 10:52           ` Jia-Ju Bai
2017-06-21 17:44       ` Bo Yu
  -- strict thread matches above, loose matches on Subject: below --
2017-05-31  9:21 Jia-Ju Bai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).