[PATCH net-next v7 1/3] net: ethernet: mtk_eth_soc: fix the RX

Eugene Markus eugene at fiftyone-percent.net
Sat Nov 28 00:34:01 PST 2026


On Sat, 14 Nov 2026 00:34:14 +0200, Sandeep Haemoon wrote:
 > Reset dma_addr to DMA_MAPPING_ERROR at the start of every iteration,
 > so a descriptor that is released without a new mapping keeps its own
 > address bits.

This bug is not theoretical: it has been corrupting memory in the field
on a BPI-R4 Pro 8X (MT7988A, 8 GiB) running OpenWrt main (r38441,
kernel 6.18.60) as a home router with a Bitcoin node behind it. We
arrived at the same one-line fix independently before finding this
series, and have tested it on that board.

You wrote on 22 Nov that the issue fixed in 1/3 came from automated
review and had not been triggered at runtime. On this board it is
triggered, through the refill allocation failure path, as below.

Symptoms, five times, between 8 minutes and 2 h 47 min into a sync with
the node's peers on the WAN port (the GMAC's own port, not DSA):
  - "BUG: Bad page map" in the node's process, then "Unable to handle
    kernel paging request" in unmap_page_range() and a panic;
  - "get_swap_device: Bad swap file entry" with no swap configured;
  - LevelDB "block checksum mismatch" on files intact on disk.
The corrupted pages held a received WAN frame starting at byte 256
(MTK_PP_HEADROOM): a page-table page had the board's WAN MAC followed by
the gateway's MAC at entry 32, and a LevelDB page in the page cache held
a complete IPv4/TCP frame from a peer's port 8333. The trigger is a
page_pool allocation failure: the page cache fills the 8 GiB and free
memory sat at 60-120 MB.

Bench test, RAM-booted kernel with PAGE_TABLE_CHECK, DEBUG_PAGEALLOC
and KFENCE; a test-only switch making every Nth RX refill fail (standing
in for a page_pool failure) and another restoring the old dma_addr
handling; a user process holding 6000 MB with a known pattern that
reports every changed page with its physical address (pagemap); TCP
into the GMAC at line rate:

   dma_addr handling   refills released with   pages changed
                       another buffer's bits
   old, run 1          166                     70, each a WAN frame
                                               at byte 256
   old, run 2          11                      4, each at exactly the
                                               address the driver
                                               computed (e.g. frame to
                                               0x1613cf100, page
                                               0x1613cf000 changed in
                                               bytes 256..1775)
   this patch          0 (59,817 and 45,274    0
                       would have been)

The other misdirected frames pointed below 0x40000000, where this SoC
has no RAM but has device registers and PCIe windows. No kernel errors
were logged in any phase: the debug options cannot see a device write.

On the board itself, the node then synced 57,736 blocks (about 6 hours
of continuous peer traffic) with this patch and no corruption; the build
before it, without the patch, corrupted after 2 h 47 min.

As this is silent memory corruption with network-supplied contents on
shipping MT7988 boards with more than 4 GiB, could 1/3 go to net on its
own, with Cc: stable, ahead of the jumbo frame work?

The analysis of the corrupted pages, the driver reading and the bench
tests were done with an AI coding assistant (Claude Code); I ran them on
my board and have checked the results.

Tested-by: Eugene Markus <eugene at fiftyone-percent.net>



More information about the linux-arm-kernel mailing list