mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Baolu Lu <baolu.lu@linux.intel.com>
To: Jiale Yao <yaojiale02@163.com>,
	David Woodhouse <dwmw2@infradead.org>,
	"Joerg Roedel (AMD)" <joro@8bytes.org>,
	Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Cc: baolu.lu@linux.intel.com
Subject: Re: [PATCH] iommu/vt-d: Fix iopf_refcount leak in nested RID replacement
Date: Tue, 6 Oct 2026 10:11:08 +0800	[thread overview]
Message-ID: <bd1240e6-c678-4be4-8f64-881d4a43b0f3@linux.intel.com> (raw)
In-Reply-To: <20260924115027.656743-1-yaojiale02@163.com>

On 9/24/2026 7:50 PM, Jiale Yao wrote:
> intel_nested_attach_dev() enables IOPF for the new nested domain without
> releasing the reference held by the old domain.  Replacing a domain with
> an IOPF-enabled domain therefore leaves an extra reference in
> info->iopf_refcount.
> 
> Commit 236dd58fabd2 ("iommu/vt-d: Fix iopf_refcount leak on RID
> domain replacement") fixed the same IOPF reference leak in the regular
> RID attach paths.  The nested RID attach path has the same old-domain
> handling bug.
> 
> Use iopf_for_domain_replace() for the attach and restore the old domain
> reference if nested PASID setup fails, matching the existing PASID path.
> 
> Signed-off-by: Jiale Yao <yaojiale02@163.com>
> Link: https://lore.kernel.org/all/20260731054329.2948252-4-baolu.lu@linux.intel.com/
> ---
>   drivers/iommu/intel/nested.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iommu/intel/nested.c b/drivers/iommu/intel/nested.c
> index 2b979bec56ce..dbcec6093d50 100644
> --- a/drivers/iommu/intel/nested.c
> +++ b/drivers/iommu/intel/nested.c
> @@ -50,7 +50,7 @@ static int intel_nested_attach_dev(struct iommu_domain *domain,
>   	if (ret)
>   		goto detach_iommu;
>   
> -	ret = iopf_for_domain_set(domain, dev);
> +	ret = iopf_for_domain_replace(domain, old, dev);
>   	if (ret)
>   		goto unassign_tag;
>   
> @@ -67,7 +67,7 @@ static int intel_nested_attach_dev(struct iommu_domain *domain,
>   
>   	return 0;
>   disable_iopf:
> -	iopf_for_domain_remove(domain, dev);
> +	iopf_for_domain_replace(old, domain, dev);
>   unassign_tag:
>   	cache_tag_unassign_domain(dmar_domain, dev, IOMMU_NO_PASID);
>   detach_iommu:

Thanks for the patch, but we already have a fix in the iommu tree:

83871c3ae10e ("iommu/vt-d: Fix iopf refcount leak in nested attach")

Thanks,
baolu

      reply	other threads:[~2026-10-06  2:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 11:50 Jiale Yao
2026-10-06  2:11 ` Baolu Lu [this message]

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=bd1240e6-c678-4be4-8f64-881d4a43b0f3@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    --cc=yaojiale02@163.com \
    /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

all inboxes | Powered by JetHome®