Re: [PATCH] net: fm10k: check size from dma region

2020-07-04 Thread Zekun Shen
On Sat, Jul 04, 2020 at 12:41:07PM -0700, Alexander Duyck wrote: > On Sat, Jul 4, 2020 at 9:37 AM Zekun Shen wrote: > > > > 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 ar

Re: [PATCH] net: fm10k: check size from dma region

2020-07-04 Thread Alexander Duyck
On Sat, Jul 4, 2020 at 9:37 AM Zekun Shen wrote: > > 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 withi

Re: [PATCH] net: fm10k: check size from dma region

2020-07-04 Thread Zekun Shen
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_

Re: [PATCH] net: fm10k: check size from dma region

2020-07-04 Thread Alexander Duyck
On Fri, Jul 3, 2020 at 11:21 AM Zekun Shen wrote: > > Size is read from a dma region as input from device. Add sanity > check of size before calling dma_sync_single_range_for_cpu > with it. > > This would prevent DMA-API warning: device driver tries to sync DMA > memory it has not allocated. > > S

[PATCH] net: fm10k: check size from dma region

2020-07-03 Thread Zekun Shen
Size is read from a dma region as input from device. Add sanity check of size before calling dma_sync_single_range_for_cpu with it. This would prevent DMA-API warning: device driver tries to sync DMA memory it has not allocated. Signed-off-by: Zekun Shen --- drivers/net/ethernet/intel/fm10k/fm1