Skip to contentSkip to conversation

Net: qla3xxx, remove sleeping in atomic

PATCH Applied Jiri Slaby 2 participants 2 messages Jun 19, 2009 – Jun 20, 2009

Subsystems (2)
lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

PATCH 1/1 Net: qla3xxx, remove sleeping in atomic

Hi, we've found this sleep-inside-spinlock.

The fix below totally untested, please review carefully.

--

We cannot sleep in ql_reset_work under spinlock, unlock before sleep, relock after.

---
 drivers/net/qla3xxx.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/qla3xxx.c +2 -0
index 8a823ec..bbc6d4d 100644
@@ -3837,7 +3837,9 @@ static void ql_reset_work(struct work_struct *work)
 						      16) | ISP_CONTROL_RI));
 			}
 
+			spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
 			ssleep(1);
+			spin_lock_irqsave(&qdev->hw_lock, hw_flags);
 		} while (--max_wait_time);
 		spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
 
Signature · 2 lines
1.6.3.2
caught by stanse
maintainer Applied
#1 lore raw

From: Jiri Slaby <[email protected]>
Date: Fri, 19 Jun 2009 17:13:32 +0200

Quoted 10 lines

Hi, we've found this sleep-inside-spinlock.

The fix below totally untested, please review carefully.

--

We cannot sleep in ql_reset_work under spinlock, unlock before sleep, relock after.

This looks good. The spinlock is just required to be held around the register accesses. It's going to drop the lock as soon as the bits settle post-reset anyways and then the driver goes off and modifies other state outside of the lock.

Applied, thanks!