Re: [PATCH net v2] net: fec: reject oversized fragments before bounce-buffer memcpy
From: Andrew Lunn
Date: Thu Sep 24 2026 - 08:45:39 EST
On Wed, Sep 23, 2026 at 06:22:01PM -0300, Aldo Ariel wrote:
> Hi Andrew,
>
> PKT_MAXBUF_SIZE = round_down(2048 - 64, 64) = 1984
> max_mtu (non-jumbo) = 1984 - VLAN_ETH_HLEN - ETH_FCS_LEN = 1962
>
> So for standard MTU, max_mtu < FEC_ENET_TX_FRSIZE and individual
> fragments should not exceed the bounce buffer.
>
> However, when the device supports jumbo frames,
> max_buf_size = MAX_JUMBO_BUF_SIZE (~16256) and max_mtu reaches ~16234.
> Scatter-gather fragments in that case can exceed FEC_ENET_TX_FRSIZE
> while still needing the bounce path for alignment or byte-swap.
>
> Should I respin with a check only for the jumbo path, or is the
> unconditional guard acceptable?
Can bounce buffers and jumbo be used at the same time?
How is the scatter-gather size determined? Maybe the better fix is to
set the fragment size based on the size of the bounce buffer when it
is in use?
Andrew