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: <dc636d1e-43f6-3ba1-7199-c78eaf88a7c7@arm.com>
Date:   Thu, 19 Jan 2023 20:52:15 +0000
From:   Robin Murphy <robin.murphy@....com>
To:     Jason Gunthorpe <jgg@...dia.com>
Cc:     joro@...tes.org, will@...nel.org, hch@....de,
        iommu@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 7/8] iommu: Clean up open-coded ownership checks

On 19/01/2023 7:31 pm, Jason Gunthorpe wrote:
> On Thu, Jan 19, 2023 at 07:18:25PM +0000, Robin Murphy wrote:
>> diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
>> index 270c3d9128ba..b2d3d309be1e 100644
>> --- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c
>> +++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c
>> @@ -79,16 +79,6 @@ static struct qcom_iommu_domain *to_qcom_iommu_domain(struct iommu_domain *dom)
>>   
>>   static const struct iommu_ops qcom_iommu_ops;
>>   
>> -static struct qcom_iommu_dev * to_iommu(struct device *dev)
>> -{
>> -	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
>> -
>> -	if (!fwspec || fwspec->ops != &qcom_iommu_ops)
>> -		return NULL;
>> -
>> -	return dev_iommu_priv_get(dev);
>> -}
>> -
>>   static struct qcom_iommu_ctx * to_ctx(struct qcom_iommu_domain *d, unsigned asid)
>>   {
>>   	struct qcom_iommu_dev *qcom_iommu = d->iommu;
>> @@ -361,7 +351,7 @@ static void qcom_iommu_domain_free(struct iommu_domain *domain)
>>   
>>   static int qcom_iommu_attach_dev(struct iommu_domain *domain, struct device *dev)
>>   {
>> -	struct qcom_iommu_dev *qcom_iommu = to_iommu(dev);
>> +	struct qcom_iommu_dev *qcom_iommu = dev_iommu_priv_get(dev);
>>   	struct qcom_iommu_domain *qcom_domain = to_qcom_iommu_domain(domain);
>>   	int ret;
> 
> The confusing checks for null qcom_iommu following this should go away
> too, right?
> 
> It should not be possible to have an ops set on the device but have an
> invalid priv..

Yeah, this was just an audit of already-redundant fwspec->ops checks, 
but another one for redundant dev_iommu_priv checks is probably 
worthwhile too.

Cheers,
Robin.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ