diff options
author | Felix Fietkau <nbd@openwrt.org> | 2015-04-14 10:07:58 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-04-14 18:57:11 (GMT) |
commit | 6a6c708469c9e10fd87adcc3abff164270538d62 (patch) | |
tree | ed99e2eca3251c5b805287f091b44793f1a9b7b0 /drivers/net | |
parent | 56faacd04509f0a60ed646473a930fe584f1cb02 (diff) | |
download | linux-6a6c708469c9e10fd87adcc3abff164270538d62.tar.xz |
bgmac: add check for oversized packets
In very rare cases, the MAC can catch an internal buffer that is bigger
than it's supposed to be. Instead of crashing the kernel, simply pass
the buffer back to the hardware
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/broadcom/bgmac.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c index 60b5c3c..5a20108 100644 --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c @@ -445,6 +445,13 @@ static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring, break; } + if (len > BGMAC_RX_ALLOC_SIZE) { + bgmac_err(bgmac, "Found oversized packet at slot %d, DMA issue!\n", + ring->start); + put_page(virt_to_head_page(buf)); + break; + } + /* Omit CRC. */ len -= ETH_FCS_LEN; |