[Intel-wired-lan] [PATCH] net: fm10k: check size from dma region
Zekun Shen
bruceshenzk at gmail.com
Sat Jul 4 16:37:04 UTC 2020
On Sat, Jul 04, 2020 at 09:05:48AM -0700, Alexander Duyck wrote:
> The upper limitation for the size should be 2K or FM10K_RX_BUFSZ, not
> PAGE_SIZE. Otherwise you are still capable of going out of bounds
> because the offset is used within the page to push the start of the
> region up by 2K.
PAGE_SIZE can drop the warning, as the dma allocated size is PAGE_SIZE.
> If this is actually fixing the warning it makes me wonder if the code
> performing the check is broken itself since we would still be
> accessing outside of the accessible DMA range.
The unbounded size is only passed to fm10k_add_rx_frag, which expects
and checks size to be less than FM10K_RX_HDR_LEN which is 256.
In this way, any boundary between 256 and 4K should work. I could address
that with a second version.
More information about the Intel-wired-lan
mailing list