mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
56faacd045
commit
6a6c708469
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue