[PATCH] um: Fix spin_lock usage in uml_net_interrupt()

From: Richard Weinberger
Date: Mon Apr 09 2012 - 10:22:55 EST


Use spin_lock_save/restore() in uml_net_interrupt() to
avoid recursive locking.

Signed-off-by: Richard Weinberger <richard@xxxxxx>
---
arch/um/drivers/net_kern.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 95f4416..5e7cf82 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -116,12 +116,13 @@ static irqreturn_t uml_net_interrupt(int irq, void *dev_id)
{
struct net_device *dev = dev_id;
struct uml_net_private *lp = netdev_priv(dev);
+ unsigned long flags;
int err;

if (!netif_running(dev))
return IRQ_NONE;

- spin_lock(&lp->lock);
+ spin_lock_irqsave(&lp->lock, flags);
while ((err = uml_net_rx(dev)) > 0) ;
if (err < 0) {
printk(KERN_ERR
@@ -140,7 +141,7 @@ static irqreturn_t uml_net_interrupt(int irq, void *dev_id)
reactivate_fd(lp->fd, UM_ETH_IRQ);

out:
- spin_unlock(&lp->lock);
+ spin_unlock_irqrestore(&lp->lock, flags);
return IRQ_HANDLED;
}

--
1.7.7.3

--
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/