[PATCH]skge napi->poll() locking bug

Previous thread: [PATCH 011/148] include/asm-x86/bug.h: checkpatch cleanups - formatting only by Joe Perches on Sunday, March 23, 2008 - 4:01 am. (218 messages)

Next thread: [ANNOUNCE] GIT 1.5.5-rc1 by Junio C Hamano on Sunday, March 23, 2008 - 6:07 am. (1 message)
To: <linux-kernel@...>
Cc: Stephen Hemminger <shemminger@...>, Jeff Garzik <jgarzik@...>
Date: Sunday, March 23, 2008 - 4:20 am

Hi all,

According to: Documentation/networking/netdevices.txt:

<cite>
napi->poll:
..........
Context: softirq
will be called with interrupts disabled by netconsole.
</cite>

napi->poll() could be called either with interrupts enabled
(in softirq context) or disabled (by netconsole), so the irq flag
should be preserved.

Inspired by Ingo's resent forcedeth patch :-)

Regards

Marin Mitov

Signed-off-by: Marin Mitov <mitov@issp.bas.bg>
===============================
--- a/drivers/net/skge.c 2008-03-23 09:06:13.000000000 +0200
+++ b/drivers/net/skge.c 2008-03-23 09:24:47.000000000 +0200
@@ -3199,12 +3199,14 @@ static int skge_poll(struct napi_struct
skge_write8(hw, Q_ADDR(rxqaddr[skge->port], Q_CSR), CSR_START);

if (work_done < to_do) {
- spin_lock_irq(&hw->hw_lock);
+ unsigned long flags;
+
+ spin_lock_irqsave(&hw->hw_lock, flags);
__netif_rx_complete(dev, napi);
hw->intr_mask |= napimask[skge->port];
skge_write32(hw, B0_IMSK, hw->intr_mask);
skge_read32(hw, B0_IMSK);
- spin_unlock_irq(&hw->hw_lock);
+ spin_unlock_irqrestore(&hw->hw_lock, flags);
}

return work_done;

--

To: Marin Mitov <mitov@...>
Cc: <linux-kernel@...>, Stephen Hemminger <shemminger@...>
Date: Tuesday, March 25, 2008 - 11:20 pm

applied

--

To: <mitov@...>
Cc: <linux-kernel@...>, <shemminger@...>, <jgarzik@...>, <netdev@...>
Date: Sunday, March 23, 2008 - 6:19 am

From: Marin Mitov <mitov@issp.bas.bg>
Date: Sun, 23 Mar 2008 10:20:09 +0200

Please send networking things at least CC:'d to netdev
as many networking developers do not subscribe to

Acked-by: David S. Miller <davem@davemloft.net>
--

Previous thread: [PATCH 011/148] include/asm-x86/bug.h: checkpatch cleanups - formatting only by Joe Perches on Sunday, March 23, 2008 - 4:01 am. (218 messages)

Next thread: [ANNOUNCE] GIT 1.5.5-rc1 by Junio C Hamano on Sunday, March 23, 2008 - 6:07 am. (1 message)