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-next>] [day] [month] [year] [list]
Message-Id: <20240227064821.128-1-zhangfei.gao@linaro.org>
Date: Tue, 27 Feb 2024 06:48:21 +0000
From: Zhangfei Gao <zhangfei.gao@...aro.org>
To: Joerg Roedel <joro@...tes.org>,
	Will Deacon <will@...nel.org>,
	jean-philippe <jean-philippe@...aro.org>,
	Jason Gunthorpe <jgg@...dia.com>,
	baolu.lu@...ux.intel.com,
	"Zhang, Tina" <tina.zhang@...el.com>,
	kevin.tian@...el.com
Cc: iommu@...ts.linux.dev,
	linux-kernel@...r.kernel.org,
	Zhangfei Gao <zhangfei.gao@...aro.org>
Subject: [PATCH rc] 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: 65d4418c5002 ("iommu/sva: Restore SVA handle sharing")
Signed-off-by: Zhangfei Gao <zhangfei.gao@...aro.org>
Reviewed-by: Jason Gunthorpe <jgg@...dia.com>
---
Based on rc6

 drivers/iommu/iommu-sva.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/iommu-sva.c b/drivers/iommu/iommu-sva.c
index 7f91c8d0064b..65814cbc8402 100644
--- a/drivers/iommu/iommu-sva.c
+++ b/drivers/iommu/iommu-sva.c
@@ -117,11 +117,11 @@ struct iommu_sva *iommu_sva_bind_device(struct device *dev, struct mm_struct *mm
 	if (ret)
 		goto out_free_domain;
 	domain->users = 1;
-	refcount_set(&handle->users, 1);
 	list_add(&domain->next, &mm->iommu_mm->sva_domains);
-	list_add(&handle->handle_item, &mm->iommu_mm->sva_handles);
 
 out:
+	refcount_set(&handle->users, 1);
+	list_add(&handle->handle_item, &mm->iommu_mm->sva_handles);
 	mutex_unlock(&iommu_sva_lock);
 	handle->dev = dev;
 	handle->domain = domain;
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ