summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-08-16 09:12:48 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-08-22 16:23:25 -0700
commit8c07a8e30ba8a2e0831da4b134202598435f8358 (patch)
tree1a090ed9c8707ed2b259b248da65907f77ec0cd6 /drivers
parent36d644b90a9e71e03064c1a5f28a53551ec3b621 (diff)
sky2: check drop truncated packets
Backport of commit 71749531f2d1954137a1a77422ef4ff29eb102dd If packet larger than MTU is received, the driver uses hardware to truncate the packet. Use the status registers to catch/drop them. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/sky2.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index d5fe418bdf42..d2646a8087a8 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -2065,6 +2065,9 @@ static struct sk_buff *sky2_receive(struct net_device *dev,
if (!(status & GMR_FS_RX_OK))
goto resubmit;
+ if (status >> 16 != length)
+ goto len_mismatch;
+
if (length < copybreak)
skb = receive_copy(sky2, re, length);
else
@@ -2074,6 +2077,11 @@ resubmit:
return skb;
+len_mismatch:
+ /* Truncation of overlength packets
+ causes PHY length to not match MAC length */
+ ++sky2->net_stats.rx_length_errors;
+
error:
++sky2->net_stats.rx_errors;
if (status & GMR_FS_RX_FF_OV) {