077-08-bgmac-add-check-for-oversized-packets.patch 761 B

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