[PATCH] ieee802154/at231rf230: deadlock in at86rf230_xmit

From: Denis Efremov
Date: Tue Feb 12 2013 - 07:58:47 EST


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@xxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/