diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2015-05-28 22:24:44 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-05-31 06:51:25 (GMT) |
commit | 25977ac77d62b3de19908979ac84c8fd5809de6f (patch) | |
tree | 329f41c29ccf0528095ee270034511b114b01f21 /drivers | |
parent | c73b01837eeeba91b9c22c67c6372a6b73f08473 (diff) | |
download | linux-25977ac77d62b3de19908979ac84c8fd5809de6f.tar.xz |
net: systemport: Add a check for oversized packets
Occasionnaly we may get oversized packets from the hardware which exceed
the nomimal 2KiB buffer size we allocate SKBs with. Add an early check
which drops the packet to avoid invoking skb_over_panic() and move on to
processing the next packet.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/broadcom/bcmsysport.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index d777b0d..909ad7a 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c @@ -638,6 +638,14 @@ static unsigned int bcm_sysport_desc_rx(struct bcm_sysport_priv *priv, p_index, priv->rx_c_index, priv->rx_read_ptr, len, status); + if (unlikely(len > RX_BUF_LENGTH)) { + netif_err(priv, rx_status, ndev, "oversized packet\n"); + ndev->stats.rx_length_errors++; + ndev->stats.rx_errors++; + dev_kfree_skb_any(skb); + goto next; + } + if (unlikely(!(status & DESC_EOP) || !(status & DESC_SOP))) { netif_err(priv, rx_status, ndev, "fragmented packet!\n"); ndev->stats.rx_dropped++; |