All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pranjal Shrivastava <praan@google.com>
To: Lu Baolu <baolu.lu@linux.intel.com>
Cc: iommu@lists.linux.dev, Kevin Tian <kevin.tian@intel.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] iommu/vt-d: Avoid relying on pci_ats_supported() for rbtree removal
Date: Mon, 23 Nov 2026 20:14:52 +0000	[thread overview]
Message-ID: <awSevGXj59a1gmBA@google.com> (raw)
In-Reply-To: <20261123003805.2828580-1-baolu.lu@linux.intel.com>

On Mon, Nov 23, 2026 at 08:38:05AM +0800, Lu Baolu wrote:
> Commit 89436f4f5412 ("iommu/vt-d: Fix WARN_ON in iommu probe path") made
> the device rbtree insertion in intel_iommu_probe_device() conditional on
> pci_ats_supported(). To match, intel_iommu_release_device() only removes
> the device from the rbtree if pci_ats_supported() is still true.
> 
> That relies on pci_ats_supported() returning the same result at release
> as it did at probe. If it changes in between, the rbtree can retain an
> entry after its device_domain_info has been freed, resulting in a
> use-after-free during a later lookup.
> 

FWIW, this already happens today for devices whose ATS is disabled by a
quirk and that are added after the IOMMU notifiers are set up (hot-plug,
VFs): the FINAL fixups clear ats_cap after the IOMMU probe. David's
patch [1] fixes that on the PCI side by moving those quirks to header
fixups, and this patch makes the vt-d side robust regardless, which also
covers Danny's change.

So maybe this (and David's patch) deserve a cc: stable?

> Checking RB_EMPTY_NODE() to track rbtree membership is common in the
> iommu subsystem. Since device_rbtree_remove() safely handles an empty
> node, call it unconditionally in the release path. This makes removal
> depend on the device's actual rbtree membership.
> 
> Fixes: 89436f4f5412 ("iommu/vt-d: Fix WARN_ON in iommu probe path")
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>

Reviewed-by: Pranjal Shrivastava <praan@google.com>

Thanks,
Praan

[1] https://lore.kernel.org/all/20261110003353.1824793-1-dmatlack@google.com/

      parent reply	other threads:[~2026-11-23 20:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23  0:38 [PATCH 1/1] iommu/vt-d: Avoid relying on pci_ats_supported() for rbtree removal Lu Baolu
2026-11-23 17:22 ` Bjorn Helgaas
2026-11-23 20:14 ` Pranjal Shrivastava [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=awSevGXj59a1gmBA@google.com \
    --to=praan@google.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=iommu@lists.linux.dev \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.