From: Marin Mitov Date: Sun, 23 Mar 2008 08:20:09 +0000 (+0200) Subject: skge napi->poll() locking bug X-Git-Tag: v2.6.25-rc8~77^2~11 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=6ef2977d414cc196baba0fb53509c5f8cd9154b4;p=linux-2.6-omap-h63xx.git skge napi->poll() locking bug According to: Documentation/networking/netdevices.txt: napi->poll: .......... Context: softirq will be called with interrupts disabled by netconsole. 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 :-) Signed-off-by: Marin Mitov Signed-off-by: Jeff Garzik --- diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 186eb8ebfda..ae52cba75f9 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c @@ -3199,12 +3199,14 @@ static int skge_poll(struct napi_struct *napi, int to_do) 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;