diff mbox

[1/1] Net: qla3xxx, remove sleeping in atomic

Message ID 1245424412-15106-1-git-send-email-jirislaby@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Jiri Slaby June 19, 2009, 3:13 p.m. UTC
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.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
 drivers/net/qla3xxx.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Comments

David Miller June 20, 2009, 8:21 a.m. UTC | #1
From: Jiri Slaby <jirislaby@gmail.com>
Date: Fri, 19 Jun 2009 17:13:32 +0200

> 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.
> 
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

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!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index 8a823ec..bbc6d4d 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -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);