Re: [PATCH 1/1] iommu/vt-d: Avoid relying on pci_ats_supported() for rbtree removal
From: Pranjal Shrivastava
Date: Mon Nov 23 2026 - 15:15:04 EST
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@xxxxxxxxxxxxxxx>
Reviewed-by: Pranjal Shrivastava <praan@xxxxxxxxxx>
Thanks,
Praan
[1] https://lore.kernel.org/all/20261110003353.1824793-1-dmatlack@xxxxxxxxxx/