lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191118151927.14b103b0@cakuba.netronome.com>
Date:   Mon, 18 Nov 2019 15:19:27 -0800
From:   Jakub Kicinski <jakub.kicinski@...ronome.com>
To:     Adi Suresh <adisuresh@...gle.com>
Cc:     netdev@...r.kernel.org, Catherine Sullivan <csully@...gle.com>
Subject: Re: [PATCH net] gve: fix dma sync bug where not all pages synced

On Mon, 18 Nov 2019 14:36:30 -0800, Adi Suresh wrote:
> The previous commit "Fixes DMA synchronization" had a bug where the

Please use the standard way of quoting commits.

> last page in the memory range could not be synced. This change fixes
> the behavior so that all the required pages are synced.
> 

Please add a Fixes tag.

> Signed-off-by: Adi Suresh <adisuresh@...gle.com>
> Reviewed-by: Catherine Sullivan <csully@...gle.com>
> ---
>  drivers/net/ethernet/google/gve/gve_tx.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ethernet/google/gve/gve_tx.c b/drivers/net/ethernet/google/gve/gve_tx.c
> index 0a9a7ee2a866..89271380bbfd 100644
> --- a/drivers/net/ethernet/google/gve/gve_tx.c
> +++ b/drivers/net/ethernet/google/gve/gve_tx.c
> @@ -393,12 +393,12 @@ static void gve_tx_fill_seg_desc(union gve_tx_desc *seg_desc,
>  static void gve_dma_sync_for_device(struct device *dev, dma_addr_t *page_buses,
>  				    u64 iov_offset, u64 iov_len)
>  {
> -	dma_addr_t dma;
> -	u64 addr;
> +	u64 last_page = (iov_offset + iov_len - 1) / PAGE_SIZE;
> +	u64 first_page = iov_offset / PAGE_SIZE;
> +	u64 page;
>  
> -	for (addr = iov_offset; addr < iov_offset + iov_len;
> -	     addr += PAGE_SIZE) {
> -		dma = page_buses[addr / PAGE_SIZE];
> +	for (page = first_page; page <= last_page; page++) {
> +		dma_addr_t dma = page_buses[page];

Empty line after variable declaration. Perhaps keep the dma declaration
outside the loop, since this is a fix the smaller the better.

>  		dma_sync_single_for_device(dev, dma, PAGE_SIZE, DMA_TO_DEVICE);
>  	}
>  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ