linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ieee802154/at231rf230: deadlock in at86rf230_xmit
@ 2013-02-12 12:57 Denis Efremov
  2013-02-12 17:07 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Denis Efremov @ 2013-02-12 12:57 UTC (permalink / raw)
  To: Alexander Smirnov; +Cc: Denis Efremov, David S. Miller, linux-kernel

spin_lock(&lp->lock) is used in at86rf230_isr interrupt
handler and in at86rf230_xmit callback to protect
lp->irq_disabled. It seems that deadlock is possible,
because:
at86rf230_xmit
   spin_lock(&lp->lock); // acquired
// interrupt
at86rf230_isr
   spin_lock(&lp->lock); // deadlock

To prevent it, spin_lock_irq* should be used in xmit callback.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Denis Efremov <yefremov.denis@gmail.com>
---
 drivers/net/ieee802154/at86rf230.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c
index a4a62e1..7c02dd9 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -543,12 +543,12 @@ at86rf230_xmit(struct ieee802154_dev *dev, struct sk_buff *skb)
 	int rc;
 	unsigned long flags;
 
-	spin_lock(&lp->lock);
+	spin_lock_irqsave(&lp->lock, flags);
 	if  (lp->irq_disabled) {
-		spin_unlock(&lp->lock);
+		spin_unlock_irqrestore(&lp->lock, flags);
 		return -EBUSY;
 	}
-	spin_unlock(&lp->lock);
+	spin_unlock_irqrestore(&lp->lock, flags);
 
 	might_sleep();
 
-- 
1.8.1.2


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

* Re: [PATCH] ieee802154/at231rf230: deadlock in at86rf230_xmit
  2013-02-12 12:57 [PATCH] ieee802154/at231rf230: deadlock in at86rf230_xmit Denis Efremov
@ 2013-02-12 17:07 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-02-12 17:07 UTC (permalink / raw)
  To: yefremov.denis; +Cc: alex.bluesman.smirnov, linux-kernel


linux-kernel is not the correct mailing list to post networking
patches, netdev@vger.kernel.org is, thank you.

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

end of thread, other threads:[~2013-02-12 17:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-12 12:57 [PATCH] ieee802154/at231rf230: deadlock in at86rf230_xmit Denis Efremov
2013-02-12 17:07 ` David Miller

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).