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:   Wed, 12 Jul 2017 09:21:18 +0200
From:   Christoph Hellwig <hch@....de>
To:     Tushar Dave <tushar.n.dave@...cle.com>
Cc:     davem@...emloft.net, chris.hyser@...cle.com,
        sowmini.varadhan@...cle.com, egtvedt@...fundet.no,
        dan.carpenter@...cle.com, krzk@...nel.org,
        bart.vanassche@...disk.com, sparclinux@...r.kernel.org,
        linux-kernel@...r.kernel.org, hch@....de, mroos@...ux.ee
Subject: Re: [sparc-next] SPARC64: Fix sun4v DMA panic

On Tue, Jul 11, 2017 at 02:34:47PM -0700, Tushar Dave wrote:
> 64bit DMA only supported on sun4v equipped with ATU IOMMU HW.
> 'Commit b02c2b0bfd7ae ("sparc: remove arch specific dma_supported
> implementations")' introduced a code that incorrectly allow
> dma_supported() to succeed for 64bit dma mask even if system doesn't
> have ATU IOMMU. This results into panic.
> 
> Fix it.
> 
> Reported-by: Meelis Roos <mroos@...ux.ee>
> Signed-off-by: Tushar Dave <tushar.n.dave@...cle.com>
> ---
>  arch/sparc/kernel/pci_sun4v.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c
> index 24f21c7..f10e2f7 100644
> --- a/arch/sparc/kernel/pci_sun4v.c
> +++ b/arch/sparc/kernel/pci_sun4v.c
> @@ -673,12 +673,14 @@ static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist,
>  static int dma_4v_supported(struct device *dev, u64 device_mask)
>  {
>  	struct iommu *iommu = dev->archdata.iommu;
> -	u64 dma_addr_mask;
> +	u64 dma_addr_mask = iommu->dma_addr_mask;
>  
> -	if (device_mask > DMA_BIT_MASK(32) && iommu->atu)
> -		dma_addr_mask = iommu->atu->dma_addr_mask;
> -	else
> -		dma_addr_mask = iommu->dma_addr_mask;
> +	if (device_mask > DMA_BIT_MASK(32)) {
> +		if (iommu->atu)
> +			dma_addr_mask = iommu->atu->dma_addr_mask;
> +		else
> +			return 0;
> +	}

This would be more readable as:

	if (device_mask > DMA_BIT_MASK(32)) {
		if (!iommu->atu)
			return 0;
		dma_addr_mask = iommu->atu->dma_addr_mask;
	}

But except for that it looks fine to me:

Reviewed-by: Christoph Hellwig <hch@....de>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ