[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKHBV24UZgcXyKd_L1s+Cvujw_Y1NDWXm+=xO=y4Z1GPb=Gmew@mail.gmail.com>
Date: Thu, 13 Jul 2023 16:41:45 +0800
From: Michael Shavit <mshavit@...gle.com>
To: Will Deacon <will@...nel.org>, Robin Murphy <robin.murphy@....com>,
Joerg Roedel <joro@...tes.org>
Cc: jean-philippe@...aro.org, nicolinc@...dia.com, jgg@...dia.com,
baolu.lu@...ux.intel.com, linux-arm-kernel@...ts.infradead.org,
iommu@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 12/13] iommu/arm-smmu-v3-sva: Remove arm_smmu_bond
> On Wed, Jun 21, 2023 at 2:44 PM Michael Shavit <mshavit@...gle.com> wrote:
> @@ -545,23 +534,12 @@ void arm_smmu_sva_notifier_synchronize(void)
> void arm_smmu_sva_remove_dev_pasid(struct iommu_domain *domain,
> struct device *dev, ioasid_t id)
> {
> - struct mm_struct *mm = domain->mm;
> - struct arm_smmu_bond *bond = NULL, *t;
> + struct arm_smmu_sva_domain *sva_domain = to_sva_domain(domain);
> struct arm_smmu_master *master = dev_iommu_priv_get(dev);
>
> mutex_lock(&sva_lock);
> - list_for_each_entry(t, &master->bonds, list) {
> - if (t->mm == mm) {
> - bond = t;
> - break;
> - }
> - }
> -
> - if (!WARN_ON(!bond)) {
> - list_del(&bond->list);
> - arm_smmu_mmu_notifier_put(bond->smmu_mn);
> - kfree(bond);
> - }
> + master->nr_attached_sva_domains -= 1;
> + arm_smmu_mmu_notifier_put(sva_domain->smmu_mn);
> mutex_unlock(&sva_lock);
> }
I've encountered a bug with this change while working on a follow-up
series. arm_smmu_sva_remove_dev_pasid() is called on the domain if
arm_smmu_sva_set_dev_pasid failed. Removing the WARN_ON(!bond)
condition removed a protection against that scenario. I have a fix for
this change that I'll push into a v5 of the series.
Powered by blists - more mailing lists