diff options
author | Stephen Hemminger <shemminger@osdl.org> | 2005-12-20 15:08:09 -0800 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-12-24 09:38:35 -0500 |
commit | 6e15b7124990e4b91645601e7a90d3fe72873336 (patch) | |
tree | 4b7e90e86467ed541c055a69362dc5ba8bc34ec8 /drivers/net/sky2.c | |
parent | 6ed995bb29f042eece8392d9bae0b83f84bcdb23 (diff) | |
download | lwn-6e15b7124990e4b91645601e7a90d3fe72873336.tar.gz lwn-6e15b7124990e4b91645601e7a90d3fe72873336.zip |
[PATCH] sky2: handle hardware packet overrun
It is possible for hardware to get confused when an oversized frame
is received. In that case, just drop the packet and increment a counter.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/sky2.c')
-rw-r--r-- | drivers/net/sky2.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index c7b4da1d717f..9b428e423c3d 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c @@ -1694,6 +1694,9 @@ static struct sk_buff *sky2_receive(struct sky2_port *sky2, if (!(status & GMR_FS_RX_OK)) goto resubmit; + if ((status >> 16) != length || length > sky2->rx_bufsize) + goto oversize; + if (length < copybreak) { skb = alloc_skb(length + 2, GFP_ATOMIC); if (!skb) @@ -1735,7 +1738,13 @@ resubmit: return skb; +oversize: + ++sky2->net_stats.rx_over_errors; + goto resubmit; + error: + ++sky2->net_stats.rx_errors; + if (netif_msg_rx_err(sky2)) printk(KERN_INFO PFX "%s: rx error, status 0x%x length %d\n", sky2->netdev->name, status, length); |