aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/patches-3.18/077-08-bgmac-add-check-for-oversized-packets.patch
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2015-04-12 22:10:40 +0000
committerFelix Fietkau <nbd@openwrt.org>2015-04-12 22:10:40 +0000
commitafafbc0d7454cb3271477698782cdf3197d06295 (patch)
tree0cf5aeb23108f087330c144a02e97f0aa48d2bae /target/linux/generic/patches-3.18/077-08-bgmac-add-check-for-oversized-packets.patch
parent09722d0bdcce6a021ec20bdefc158878ce49b8dc (diff)
downloadupstream-afafbc0d7454cb3271477698782cdf3197d06295.tar.gz
upstream-afafbc0d7454cb3271477698782cdf3197d06295.tar.bz2
upstream-afafbc0d7454cb3271477698782cdf3197d06295.zip
kernel: bgmac: add more DMA related fixes
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 45407
Diffstat (limited to 'target/linux/generic/patches-3.18/077-08-bgmac-add-check-for-oversized-packets.patch')
-rw-r--r--target/linux/generic/patches-3.18/077-08-bgmac-add-check-for-oversized-packets.patch28
1 files changed, 28 insertions, 0 deletions
diff --git a/target/linux/generic/patches-3.18/077-08-bgmac-add-check-for-oversized-packets.patch b/target/linux/generic/patches-3.18/077-08-bgmac-add-check-for-oversized-packets.patch
new file mode 100644
index 0000000000..fa45a43686
--- /dev/null
+++ b/target/linux/generic/patches-3.18/077-08-bgmac-add-check-for-oversized-packets.patch
@@ -0,0 +1,28 @@
+From: Felix Fietkau <nbd@openwrt.org>
+Date: Sun, 12 Apr 2015 22:28:20 +0200
+Subject: [PATCH] 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>
+---
+
+--- a/drivers/net/ethernet/broadcom/bgmac.c
++++ b/drivers/net/ethernet/broadcom/bgmac.c
+@@ -422,6 +422,14 @@ static int bgmac_dma_rx_read(struct bgma
+ break;
+ }
+
++ if (len > BGMAC_RX_ALLOC_SIZE) {
++ bgmac_err(bgmac, "Found oversized packet at slot %d, DMA issue!\n",
++ ring->start);
++ rx->len = cpu_to_le16(0xdead);
++ rx->flags = cpu_to_le16(0xbeef);
++ break;
++ }
++
+ /* Omit CRC. */
+ len -= ETH_FCS_LEN;
+