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] [day] [month] [year] [list]
Message-ID: <2430049f-bcb3-466b-fbed-03b4cd0e895a@amd.com>
Date:   Wed, 14 Sep 2022 20:16:09 +0530
From:   Vasant Hegde <vasant.hegde@....com>
To:     Nicolin Chen <nicolinc@...dia.com>, joro@...tes.org,
        suravee.suthikulpanit@....com, will@...nel.org,
        robin.murphy@....com
Cc:     jgg@...dia.com, kevin.tian@...el.com, iommu@...ts.linux.dev,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 02/13] iommu/amd: Drop unnecessary checks in
 amd_iommu_attach_device()

On 9/14/2022 10:44 AM, Nicolin Chen wrote:
> The same checks are done in amd_iommu_probe_device(). If any of them fails
> there, then the device won't get a group, so there's no way for it to even
> reach amd_iommu_attach_device any more.
> 
> Suggested-by: Robin Murphy <robin.murphy@....com>
> Cc: Joerg Roedel <joro@...tes.org>
> Cc: Suravee Suthikulpanit <suravee.suthikulpanit@....com>
> Signed-off-by: Nicolin Chen <nicolinc@...dia.com>

Looks good to me.

Reviewed-by: Vasant Hegde <vasant.hegde@....com>

-Vasant

> ---
>  drivers/iommu/amd/iommu.c | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
> index 828672a46a3d..930d9946b9f7 100644
> --- a/drivers/iommu/amd/iommu.c
> +++ b/drivers/iommu/amd/iommu.c
> @@ -2135,21 +2135,13 @@ static void amd_iommu_detach_device(struct iommu_domain *dom,
>  static int amd_iommu_attach_device(struct iommu_domain *dom,
>  				   struct device *dev)
>  {
> +	struct iommu_dev_data *dev_data = dev_iommu_priv_get(dev);
>  	struct protection_domain *domain = to_pdomain(dom);
> -	struct iommu_dev_data *dev_data;
> -	struct amd_iommu *iommu;
> +	struct amd_iommu *iommu = rlookup_amd_iommu(dev);
>  	int ret;
>  
> -	if (!check_device(dev))
> -		return -EINVAL;
> -
> -	dev_data = dev_iommu_priv_get(dev);
>  	dev_data->defer_attach = false;
>  
> -	iommu = rlookup_amd_iommu(dev);
> -	if (!iommu)
> -		return -EINVAL;
> -
>  	if (dev_data->domain)
>  		detach_device(dev);
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ