Re: [PATCH] PCI: Disable ATS via quirk before notifying IOMMU drivers

From: David Matlack

Date: Tue Feb 24 2026 - 12:19:41 EST


On Mon, Feb 23, 2026 at 12:37 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> On Mon, Feb 23, 2026 at 06:40:16PM +0000, David Matlack wrote:
> > Ensure that PCI devices that have ATS disabled via quirk have it
> > disabled before IOMMU drivers are notified about the device. Otherwise
> > the IOMMU driver will see that the device has ATS enabled during probing
> > and then later it will get disabled.
> >
> > This fixes at least one bug in the Intel IOMMU driver where it adds the
> > device to an rbtree because it sees ATS is enabled, but then ATS gets
> > disabled via quirk. When the device is destroyed (e.g. hot-unplug, VF
> > destruction, etc.) the driver sees that ATS is disabled and does not
> > remove it from the rbtree. This inevitably leads to a use-after-free
> > and corruption of the rbtree.
> >
> > Fix this by disabling ATS via quirk during "early" fixups instead of
> > "final" fixups.
>
> Hmm... Sounds to me like a premature disablement, but I leave it the experts.

What do you mean by "premature disablement"?

> What I think about the case, that IOMMU should be probably fixed to avoid such
> situation for all level of quirks. Can it be feasible?

What do you mean by the "IOMMU should be fixed"? Are you saying the
IOMMU should be prepared to handle quirks disabling features on
devices after the IOMMU driver is notified about a device?

>
> > Fixes: a18615b1cfc0 ("PCI: Disable ATS for specific Intel IPU E2000 devices")
> > Closes: https://lore.kernel.org/linux-iommu/aYUQ_HkDJU9kjsUl@xxxxxxxxxx/
>
> > Cc: Raghavendra Rao Ananta <rananta@xxxxxxxxxx>
> > Cc: David Woodhouse <dwmw2@xxxxxxxxxxxxx>
> > Cc: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
>
> These...
>
> > Signed-off-by: David Matlack <dmatlack@xxxxxxxxxx>
> > ---
>
> ...may go here with the same effect on email, but reducing the unneeded noise
> in the actual Git history.

Ahh, will do. Thanks for the tip.