[patch, -rc5-mm3] lock validator: fix ns83820.c irq-flags part 3

From: Arjan van de Ven
Date: Sun Jun 04 2006 - 06:07:47 EST


On Sun, 2006-06-04 at 02:53 -0700, Barry K. Nathan wrote:
> On 6/4/06, Arjan van de Ven <arjan@xxxxxxxxxxxxxxx> wrote:
> > just the preempt the next email from Barry; while fixing this one I
> > looked at the usage of the locks more and found another patch needed...
> [snip]
>
> Nice try, but it didn't work. ~_^
>
> I was about to reply to the previous ns83820 patch with my dmesg, when
> I saw this one. I applied this patch too, and like the previous patch,
> it reports an instance of illegal lock usage. My dmesg follows.
> --


ok this is a real driver deadlock:

The ns83820 driver enabled interrupts (by unlocking the misc_lock with
_irq) while still holding the rx_info.lock, which is required to be irq
safe since it's used in the ISR like this:
writel(1, dev->base + IER);
spin_unlock_irq(&dev->misc_lock);
kick_rx(ndev);
spin_unlock_irq(&dev->rx_info.lock);

This is can cause a deadlock if an irq was pending at the first
spin_unlock_irq already, or if one would hit during kick_rx().
Simply remove the first _irq solves this

Signed-off-by: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>


---
drivers/net/ns83820.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.17-rc5-mm3/drivers/net/ns83820.c
===================================================================
--- linux-2.6.17-rc5-mm3.orig/drivers/net/ns83820.c
+++ linux-2.6.17-rc5-mm3/drivers/net/ns83820.c
@@ -808,7 +808,7 @@ static int ns83820_setup_rx(struct net_d

writel(dev->IMR_cache, dev->base + IMR);
writel(1, dev->base + IER);
- spin_unlock_irq(&dev->misc_lock);
+ spin_unlock(&dev->misc_lock);

kick_rx(ndev);


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