Skip to contentSkip to conversation

net: dsa: Fix Marvell Egress Trailer check

PATCH Applied Neil Armstrong 3 participants 3 messages Sep 22, 2015 – Sep 23, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: dsa: Fix Marvell Egress Trailer check

The Marvell Egress rx trailer check must be fixed to correctly detect bad bits in the third byte of the Eggress trailer as described in the Table 28 of the 88E6060 datasheet.
The current code incorrectly omits to check the third byte and checks the fourth byte twice.

---
 net/dsa/tag_trailer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/dsa/tag_trailer.c +1 -1
index e268f9d..d0526a9 100644
@@ -84,7 +84,7 @@ static int trailer_rcv(struct sk_buff *skb, struct net_device *dev,
 
 	trailer = skb_tail_pointer(skb) - 4;
 	if (trailer[0] != 0x80 || (trailer[1] & 0xf8) != 0x00 ||
-	    (trailer[3] & 0xef) != 0x00 || trailer[3] != 0x00)
+	    (trailer[2] & 0xef) != 0x00 || trailer[3] != 0x00)
 		goto out_drop;
 
 	source_port = trailer[1] & 7;
Signature · 1 line
1.9.1
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Neil Armstrong

The Marvell Egress rx trailer check must be fixed to correctly detect bad bits in the third byte of the Eggress trailer as described in the Table 28 of the 88E6060 datasheet.
The current code incorrectly omits to check the third byte and checks the fourth byte twice.

Nice catch.

Quoted 18 lines
---
  net/dsa/tag_trailer.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
net/dsa/tag_trailer.c +1 -1
index e268f9d..d0526a9 100644
@@ -84,7 +84,7 @@ static int trailer_rcv(struct sk_buff *skb, struct net_device *dev,
 
  	trailer = skb_tail_pointer(skb) - 4;
  	if (trailer[0] != 0x80 || (trailer[1] & 0xf8) != 0x00 ||
-	    (trailer[3] & 0xef) != 0x00 || trailer[3] != 0x00)
+	    (trailer[2] & 0xef) != 0x00 || trailer[3] != 0x00)
  		goto out_drop;
 
  	source_port = trailer[1] & 7;
maintainer Applied
#2 lore raw
In reply to Neil Armstrong

From: Neil Armstrong <[email protected]>
Date: Tue, 22 Sep 2015 11:28:14 +0200

Quoted 8 lines

The Marvell Egress rx trailer check must be fixed to correctly detect bad bits in the third byte of the Eggress trailer as described in the Table 28 of the 88E6060 datasheet.
The current code incorrectly omits to check the third byte and checks the fourth byte twice.

Applied, thanks.