[patch 10/16] sky2: status ring race fix

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>, <stable@...>
Cc: Justin Forbes <jmforbes@...>, Zwane Mwaikambo <zwane@...>, Theodore Ts'o <tytso@...>, Randy Dunlap <rdunlap@...>, Dave Jones <davej@...>, Chuck Wolber <chuckw@...>, Chris Wedgwood <reviews@...>, Michael Krufky <mkrufky@...>, Chuck Ebbert <cebbert@...>, Domenico Andreoli <cavokz@...>, <torvalds@...>, <akpm@...>, <alan@...>, Stephen Hemminger <shemminger@...>, Jeff Garzik <jeff@...>
Date: Thursday, November 15, 2007 - 2:40 am

-stable review patch.  If anyone has any objections, please let us know.

------------------

From: Stephen Hemminger <shemminger@linux-foundation.org>

patch ab5adecb2d02f3688719dfb5936a82833fcc3955 in mainline.

The D-Link PCI-X board (and maybe others) can lie about status
ring entries. It seems it will update the register for last status
index before completing the DMA for the ring entry. To avoid reading
stale data, zap the old entry and check.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/net/sky2.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -2246,20 +2246,26 @@ static int sky2_status_intr(struct sky2_
 	while (hw->st_idx != hwidx) {
 		struct sky2_port *sky2;
 		struct sky2_status_le *le  = hw->st_le + hw->st_idx;
-		unsigned port = le->css & CSS_LINK_BIT;
+		unsigned port;
 		struct net_device *dev;
 		struct sk_buff *skb;
 		u32 status;
 		u16 length;
+		u8 opcode = le->opcode;
+
+		if (!(opcode & HW_OWNER))
+			break;
 
 		hw->st_idx = RING_NEXT(hw->st_idx, STATUS_RING_SIZE);
 
+		port = le->css & CSS_LINK_BIT;
 		dev = hw->dev[port];
 		sky2 = netdev_priv(dev);
 		length = le16_to_cpu(le->length);
 		status = le32_to_cpu(le->status);
 
-		switch (le->opcode & ~HW_OWNER) {
+		le->opcode = 0;
+		switch (opcode & ~HW_OWNER) {
 		case OP_RXSTAT:
 			++rx[port];
 			skb = sky2_receive(dev, length, status);
@@ -2352,7 +2358,7 @@ static int sky2_status_intr(struct sky2_
 		default:
 			if (net_ratelimit())
 				printk(KERN_WARNING PFX
-				       "unknown status opcode 0x%x\n", le->opcode);
+				       "unknown status opcode 0x%x\n", opcode);
 		}
 	}
 

-- 
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 14/16] ipw2100: send WEXT scan events, Greg KH, (Thu Nov 15, 2:41 am)
[patch 09/16] skge: XM PHY handling fixes, Greg KH, (Thu Nov 15, 2:40 am)
[patch 10/16] sky2: status ring race fix, Greg KH, (Thu Nov 15, 2:40 am)
[patch 03/16] ehea: 64K page kernel support fix, Greg KH, (Thu Nov 15, 2:40 am)
Re: [patch 08/16] skge: fix ram buffer size calculation, Linus Torvalds, (Thu Nov 15, 12:11 pm)
Re: [patch 08/16] skge: fix ram buffer size calculation, Linus Torvalds, (Thu Nov 15, 12:48 pm)
Re: [patch 08/16] skge: fix ram buffer size calculation, Heikki Orsila, (Fri Nov 16, 5:03 pm)
Re: [patch 08/16] skge: fix ram buffer size calculation, Stephen Hemminger, (Thu Nov 15, 12:27 pm)
Re: [patch 08/16] skge: fix ram buffer size calculation, Heikki Orsila, (Thu Nov 15, 5:57 pm)
Re: [patch 08/16] skge: fix ram buffer size calculation, Linus Torvalds, (Thu Nov 15, 12:50 pm)
[patch 04/16] forcedeth msi bugfix, Greg KH, (Thu Nov 15, 2:40 am)
[patch 07/16] Fix L2TP oopses., Greg KH, (Thu Nov 15, 2:40 am)
[patch 05/16] forcedeth: add MCP77 device IDs, Greg KH, (Thu Nov 15, 2:40 am)
[patch 02/16] libertas: fix endianness breakage, Greg KH, (Thu Nov 15, 2:39 am)
[patch 01/16] libertas: more endianness breakage, Greg KH, (Thu Nov 15, 2:39 am)