diff options
author | Felix Fietkau <nbd@openwrt.org> | 2015-04-14 12:07:58 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-04-14 20:57:11 +0200 |
commit | 6a6c708469c9e10fd87adcc3abff164270538d62 (patch) | |
tree | ed99e2eca3251c5b805287f091b44793f1a9b7b0 /drivers/net/ethernet/broadcom | |
parent | bgmac: simplify/optimize rx DMA error handling (diff) | |
download | linux-6a6c708469c9e10fd87adcc3abff164270538d62.tar.xz linux-6a6c708469c9e10fd87adcc3abff164270538d62.zip |
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/ethernet/broadcom')
-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 60b5c3ca8551..5a20108c80e5 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; |