Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Florian Fainelli and committed by
David S. Miller
25977ac7 c73b0183

+8
+8
drivers/net/ethernet/broadcom/bcmsysport.c
··· 638 638 p_index, priv->rx_c_index, priv->rx_read_ptr, 639 639 len, status); 640 640 641 + if (unlikely(len > RX_BUF_LENGTH)) { 642 + netif_err(priv, rx_status, ndev, "oversized packet\n"); 643 + ndev->stats.rx_length_errors++; 644 + ndev->stats.rx_errors++; 645 + dev_kfree_skb_any(skb); 646 + goto next; 647 + } 648 + 641 649 if (unlikely(!(status & DESC_EOP) || !(status & DESC_SOP))) { 642 650 netif_err(priv, rx_status, ndev, "fragmented packet!\n"); 643 651 ndev->stats.rx_dropped++;