public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: vsntk18@gmail.com
To: gregkh@linuxfoundation.org, stable@vger.kernel.org
Cc: baolu.lu@linux.intel.com, black.hawk@163.com, jgg@nvidia.com,
	joro@8bytes.org, Vasant Karasulli <vsntk18@gmail.com>,
	Vasant Karasulli <vkarasulli@suse.de>
Subject: [PATCH 5.15-stable v2] iommu: fix a reference count leak in iommu_sva_bind_device()
Date: Thu, 19 Mar 2026 15:51:37 +0100	[thread overview]
Message-ID: <20260319145137.23934-1-vsntk18@gmail.com> (raw)

From: Vasant Karasulli <vsntk18@gmail.com>

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: b34289505180 ("iommu: disable SVA when CONFIG_X86 is set")
Signed-off-by: Vasant Karasulli <vkarasulli@suse.de>
---
v2:
  - addressed formatting mistakes in the changelog

 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


                 reply	other threads:[~2026-03-19 14:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260319145137.23934-1-vsntk18@gmail.com \
    --to=vsntk18@gmail.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=black.hawk@163.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jgg@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=stable@vger.kernel.org \
    --cc=vkarasulli@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox