summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/broadcom
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2015-04-14 12:07:58 +0200
committerDavid S. Miller <davem@davemloft.net>2015-04-14 20:57:11 +0200
commit6a6c708469c9e10fd87adcc3abff164270538d62 (patch)
treeed99e2eca3251c5b805287f091b44793f1a9b7b0 /drivers/net/ethernet/broadcom
parentbgmac: simplify/optimize rx DMA error handling (diff)
downloadlinux-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.c7
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;