Skip to content

Commit 6384c56

Browse files
zhangfeigaojoergroedel
authored andcommitted
iommu/sva: Fix SVA handle sharing in multi device case
iommu_sva_bind_device will directly goto out in multi-device case when found existing domain, ignoring list_add handle, which causes the handle to fail to be shared. Fixes: 65d4418 ("iommu/sva: Restore SVA handle sharing") Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Link: https://lore.kernel.org/r/20240227064821.128-1-zhangfei.gao@linaro.org Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent d206a76 commit 6384c56

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/iommu/iommu-sva.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ struct iommu_sva *iommu_sva_bind_device(struct device *dev, struct mm_struct *mm
117117
if (ret)
118118
goto out_free_domain;
119119
domain->users = 1;
120-
refcount_set(&handle->users, 1);
121120
list_add(&domain->next, &mm->iommu_mm->sva_domains);
122-
list_add(&handle->handle_item, &mm->iommu_mm->sva_handles);
123121

124122
out:
123+
refcount_set(&handle->users, 1);
124+
list_add(&handle->handle_item, &mm->iommu_mm->sva_handles);
125125
mutex_unlock(&iommu_sva_lock);
126126
handle->dev = dev;
127127
handle->domain = domain;

0 commit comments

Comments
 (0)