public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5.15-stable] iommu: fix a reference count leak in iommu_sva_bind_device()
@ 2026-03-19 14:25 vsntk18
  2026-03-19 14:35 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: vsntk18 @ 2026-03-19 14:25 UTC (permalink / raw)
  To: gregkh, stable
  Cc: baolu.lu, black.hawk, jgg, joro, Vasant Karasulli,
	Vasant Karasulli

From: Vasant Karasulli <vsntk18@gmail.com>

From: Vasant Karasulli <vkarasulli@suse.de>

commit b34289505180 ("iommu: disable SVA when CONFIG_X86 is set")
disables SVA to mitigate a security vulnerability. 

Due the current placement of the condition check,
function returns after iommu_group_get() without a corresponding
iommu_group_put(). So move the condition check above.

This is a stable-only fix applicable to linux-5.15.y.

Fixes: b34289505("iommu: disable SVA when CONFIG_X86 is set")

Signed-off-by: Vasant Karasulli <vkarasulli@suse.de>
---
 drivers/iommu/iommu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 964170f90597..25119d75537c 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -3061,6 +3061,9 @@ iommu_sva_bind_device(struct device *dev, struct mm_struct *mm, void *drvdata)
 	struct iommu_sva *handle = ERR_PTR(-EINVAL);
 	const struct iommu_ops *ops = dev->bus->iommu_ops;
 
+	if (IS_ENABLED(CONFIG_X86))
+		return ERR_PTR(-EOPNOTSUPP);
+
 	if (!ops || !ops->sva_bind)
 		return ERR_PTR(-ENODEV);
 
@@ -3068,9 +3071,6 @@ iommu_sva_bind_device(struct device *dev, struct mm_struct *mm, void *drvdata)
 	if (!group)
 		return ERR_PTR(-ENODEV);
 
-	if (IS_ENABLED(CONFIG_X86))
-		return ERR_PTR(-EOPNOTSUPP);
-
 	/* Ensure device count and domain don't change while we're binding */
 	mutex_lock(&group->mutex);
 

base-commit: 3330a8d33e086f76608bb4e80a3dc569d04a8814
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-19 14:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-19 14:25 [PATCH 5.15-stable] iommu: fix a reference count leak in iommu_sva_bind_device() vsntk18
2026-03-19 14:35 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox