mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Peiyang He <peiyang_he@smail.nju.edu.cn>
Cc: kevin.tian@intel.com, joro@8bytes.org, will@kernel.org,
	iommu@lists.linux.dev, robin.murphy@arm.com,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	nicolinc@nvidia.com
Subject: Re: [PATCH] iommufd: Fix wrong hwpt passed to iommufd_auto_response_faults on replace
Date: Mon, 13 Jul 2026 13:53:17 -0300	[thread overview]
Message-ID: <20260713165317.GE3133966@ziepe.ca> (raw)
In-Reply-To: <9D652384339C69D5+20260710122952.885325-1-peiyang_he@smail.nju.edu.cn>

On Fri, Jul 10, 2026 at 08:29:52PM +0800, Peiyang He wrote:
> iommufd_hwpt_replace_device() calls:
> 
> 	iommufd_auto_response_faults(hwpt, old_handle);
> 
> passing the *new* hwpt together with the handle of
> the device's *old* domain. This should be a parameter mismatch:
> 
> 1. Semantically, iommufd_auto_response_faults(x, handle) scans
>    x->fault's deliver list and response xarray for groups matching
>    "handle". A group is queued under the hwpt that was attached at
>    fault-delivery time. old_handle is fetched *before* the domain switch,
>    so its group lives on old->fault, not on the new hwpt->fault.
> 
> 2. Historically, the first argument was "old". The routine was
>    introduced by commit b7d8833677ba ("iommufd: Fault-capable hwpt
>    attach/detach/replace") as __fault_domain_replace_dev() in
>    fault.c, correctly calling iommufd_auto_response_faults(old, curr).
>    Commit fb21b1568ada ("iommufd: Make attach_handle generic than
>    fault specific") moved this into iommufd_hwpt_replace_device() in
>    device.c and swapped it to "hwpt". This should be a refactor regression,
>    not an intentional change.
> 
> Fix this by passing "old" instead.
> 
> Reported-by: Peiyang He <peiyang_he@smail.nju.edu.cn>
> Fixes: fb21b1568ada ("iommufd: Make attach_handle generic than fault specific")
> Cc: stable@vger.kernel.org
> Signed-off-by: Peiyang He <peiyang_he@smail.nju.edu.cn>
> ---
>  drivers/iommu/iommufd/device.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied

Thanks,
Jason

      parent reply	other threads:[~2026-07-13 16:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10 12:29 Peiyang He
2026-07-13  6:11 ` Tian, Kevin
2026-07-13 16:53 ` Jason Gunthorpe [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=20260713165317.GE3133966@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolinc@nvidia.com \
    --cc=peiyang_he@smail.nju.edu.cn \
    --cc=robin.murphy@arm.com \
    --cc=stable@vger.kernel.org \
    --cc=will@kernel.org \
    /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