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: <c6ee1ce0-7193-be63-c84d-73795c727d26@nvidia.com>
Date:   Wed, 30 Aug 2017 15:22:05 +0100
From:   Jon Hunter <jonathanh@...dia.com>
To:     Joerg Roedel <joro@...tes.org>
CC:     Hiroshi Doyu <hdoyu@...dia.com>,
        Thierry Reding <thierry.reding@...il.com>,
        Robin Murphy <robin.murphy@....com>,
        <iommu@...ts.linux-foundation.org>, <linux-tegra@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, Joerg Roedel <jroedel@...e.de>
Subject: Re: [PATCH 1/2] iommu/tegra: Add support for struct iommu_device

Hi Joerg,

On 30/08/17 13:09, Joerg Roedel wrote:
> Hi Jon,
> 
> On Wed, Aug 30, 2017 at 12:04:38PM +0100, Jon Hunter wrote:
>> With next-20170829 I am seeing several Tegra boards crashing [0][1] on
>> boot in tegra_smmu_probe() and the bisect is point to this commit. Looks
>> like there maybe a sequence problem between calls to bus_set_iommu() and
>> iommu_device_add_sysfs() which results in a NULL pointer dereference.
> 
> Thanks for the report. Can you please test whether the patch below
> fixes the problem?
> 
> Thanks,
> 
> 	Joerg
> 
> diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
> index 2802e12e6a54..48ffbe95a663 100644
> --- a/drivers/iommu/tegra-smmu.c
> +++ b/drivers/iommu/tegra-smmu.c
> @@ -949,10 +949,6 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev,
>  
>  	tegra_smmu_ahb_enable();
>  
> -	err = bus_set_iommu(&platform_bus_type, &tegra_smmu_ops);
> -	if (err < 0)
> -		return ERR_PTR(err);
> -
>  	err = iommu_device_sysfs_add(&smmu->iommu, dev, NULL, dev_name(dev));
>  	if (err)
>  		return ERR_PTR(err);
> @@ -965,6 +961,10 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev,
>  		return ERR_PTR(err);
>  	}
>  
> +	err = bus_set_iommu(&platform_bus_type, &tegra_smmu_ops);
> +	if (err < 0)
> +		return ERR_PTR(err);
> +

Yes I can confirm that this fixes the crash. I assume that you will fix
the error path for bus_set_iommu() above as I believe now it needs to
call iommu_device_sysfs_remove().

Cheers!
Jon

-- 
nvpublic

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ