Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1723386

Re: [PATCH 1/2] iommu/tegra: Add support for struct iommu_device

From Jon Hunter <jonathanh@nvidia.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] iommu/tegra: Add support for struct iommu_device
Date 2017-08-30 16:30 +0200
Message-ID <ukcae-ZN-21@gated-at.bofh.it> (permalink)
References <ucHEd-548-5@gated-at.bofh.it> <ucHEe-548-23@gated-at.bofh.it> <uk92I-7yD-25@gated-at.bofh.it> <uk9YJ-87p-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH 1/2] iommu/tegra: Add support for struct iommu_device Jon Hunter <jonathanh@nvidia.com> - 2017-08-30 13:10 +0200
  Re: [PATCH 1/2] iommu/tegra: Add support for struct iommu_device Joerg Roedel <joro@8bytes.org> - 2017-08-30 14:10 +0200
    Re: [PATCH 1/2] iommu/tegra: Add support for struct iommu_device Jon Hunter <jonathanh@nvidia.com> - 2017-08-30 16:30 +0200
      Re: [PATCH 1/2] iommu/tegra: Add support for struct iommu_device Joerg Roedel <joro@8bytes.org> - 2017-08-30 17:40 +0200
        Re: [PATCH 1/2] iommu/tegra: Add support for struct iommu_device Jon Hunter <jonathanh@nvidia.com> - 2017-08-30 19:00 +0200
        Re: [PATCH 1/2] iommu/tegra: Add support for struct iommu_device Jon Hunter <jonathanh@nvidia.com> - 2017-08-31 12:30 +0200

csiph-web