Skip to content

Commit fdc69d3

Browse files
jgunthorpewilldeacon
authored andcommitted
iommu/arm-smmu-v3: Do not allow a SVA domain to be set on the wrong PASID
The SVA code is wired to assume that the SVA is programmed onto the mm->pasid. The current core code always does this, so it is fine. Add a check for clarity. Tested-by: Nicolin Chen <nicolinc@nvidia.com> Tested-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/3-v6-228e7adf25eb+4155-smmuv3_newapi_p2_jgg@nvidia.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent 734554f commit fdc69d3

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,9 @@ static int arm_smmu_sva_set_dev_pasid(struct iommu_domain *domain,
569569
int ret = 0;
570570
struct mm_struct *mm = domain->mm;
571571

572+
if (mm_get_enqcmd_pasid(mm) != id)
573+
return -EINVAL;
574+
572575
mutex_lock(&sva_lock);
573576
ret = __arm_smmu_sva_bind(dev, id, mm);
574577
mutex_unlock(&sva_lock);

0 commit comments

Comments
 (0)