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]
Date:   Thu, 24 Mar 2022 11:25:06 +0100
From:   Oleksandr Natalenko <oleksandr@...alenko.name>
To:     Robin Murphy <robin.murphy@....com>, Christoph Hellwig <hch@....de>
Cc:     Linus Torvalds <torvalds@...ux-foundation.org>,
        Halil Pasic <pasic@...ux.ibm.com>,
        Christoph Hellwig <hch@....de>,
        Marek Szyprowski <m.szyprowski@...sung.com>,
        Toke Høiland-Jørgensen <toke@...e.dk>,
        Kalle Valo <kvalo@...nel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Olha Cherevyk <olha.cherevyk@...il.com>,
        iommu <iommu@...ts.linux-foundation.org>,
        linux-wireless <linux-wireless@...r.kernel.org>,
        Netdev <netdev@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        stable <stable@...r.kernel.org>
Subject: Re: [REGRESSION] Recent swiotlb DMA_FROM_DEVICE fixes break ath9k-based AP

Hello.

On čtvrtek 24. března 2022 6:57:32 CET Christoph Hellwig wrote:
> On Wed, Mar 23, 2022 at 08:54:08PM +0000, Robin Murphy wrote:
> > I'll admit I still never quite grasped the reason for also adding the 
> > override to swiotlb_sync_single_for_device() in aa6f8dcbab47, but I think 
> > by that point we were increasingly tired and confused and starting to 
> > second-guess ourselves (well, I was, at least). I don't think it's wrong 
> > per se, but as I said I do think it can bite anyone who's been doing 
> > dma_sync_*() wrong but getting away with it until now. If ddbd89deb7d3 
> > alone turns out to work OK then I'd be inclined to try a partial revert of 
> > just that one hunk.
> 
> Agreed.  Let's try that first.
> 
> Oleksandr, can you try the patch below:
> 
> 
> diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
> index 6db1c475ec827..6c350555e5a1c 100644
> --- a/kernel/dma/swiotlb.c
> +++ b/kernel/dma/swiotlb.c
> @@ -701,13 +701,10 @@ void swiotlb_tbl_unmap_single(struct device *dev, phys_addr_t tlb_addr,
>  void swiotlb_sync_single_for_device(struct device *dev, phys_addr_t tlb_addr,
>  		size_t size, enum dma_data_direction dir)
>  {
> -	/*
> -	 * Unconditional bounce is necessary to avoid corruption on
> -	 * sync_*_for_cpu or dma_ummap_* when the device didn't overwrite
> -	 * the whole lengt of the bounce buffer.
> -	 */
> -	swiotlb_bounce(dev, tlb_addr, size, DMA_TO_DEVICE);
> -	BUG_ON(!valid_dma_direction(dir));
> +	if (dir == DMA_TO_DEVICE || dir == DMA_BIDIRECTIONAL)
> +		swiotlb_bounce(dev, tlb_addr, size, DMA_TO_DEVICE);
> +	else
> +		BUG_ON(dir != DMA_FROM_DEVICE);
>  }
>  
>  void swiotlb_sync_single_for_cpu(struct device *dev, phys_addr_t tlb_addr,
> 

With this patch the AP works for me.

Thanks.

-- 
Oleksandr Natalenko (post-factum)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ