kernel: update kernel 3.18 to version 3.18.23
[openwrt/staging/chunkeey.git] / target / linux / generic / patches-3.18 / 077-08-bgmac-add-check-for-oversized-packets.patch
1 From: Felix Fietkau <nbd@openwrt.org>
2 Date: Sun, 12 Apr 2015 22:28:20 +0200
3 Subject: [PATCH] bgmac: add check for oversized packets
4
5 In very rare cases, the MAC can catch an internal buffer that is bigger
6 than it's supposed to be. Instead of crashing the kernel, simply pass
7 the buffer back to the hardware
8
9 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 ---
11
12 --- a/drivers/net/ethernet/broadcom/bgmac.c
13 +++ b/drivers/net/ethernet/broadcom/bgmac.c
14 @@ -445,6 +445,13 @@ static int bgmac_dma_rx_read(struct bgma
15 break;
16 }
17
18 + if (len > BGMAC_RX_ALLOC_SIZE) {
19 + bgmac_err(bgmac, "Found oversized packet at slot %d, DMA issue!\n",
20 + ring->start);
21 + put_page(virt_to_head_page(buf));
22 + break;
23 + }
24 +
25 /* Omit CRC. */
26 len -= ETH_FCS_LEN;
27