From: sashiko-bot@kernel.org
To: "Pranjal Shrivastava" <praan@google.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v8 4/4] iommu/vt-d: Fail probe on ATS configuration failure
Date: Thu, 04 Jun 2026 18:34:52 +0000 [thread overview]
Message-ID: <20260604183452.DFD021F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260604182116.3179005-5-praan@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Unconditional rbtree removal of an unlinked node on error paths in `intel_iommu_probe_device()` empties the device tracking tree.
--
commit edcf0a64984f0847eb81ddb322f530951d47a01a
Author: Pranjal Shrivastava <praan@google.com>
iommu/vt-d: Fail probe on ATS configuration failure
Update the Intel VT-d driver to handle ATS configuration and enablement
more strictly. Specifically, update the device probe to fail if
pci_prepare_ats() returns an error. This ensures that any ATS-capable
master reaching the attach phase is guaranteed to have a valid config.
> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
> index c3d18cd77d2f1..9242cd9651307 100644
> --- a/drivers/iommu/intel/iommu.c
> +++ b/drivers/iommu/intel/iommu.c
[ ... ]
> @@ -3288,7 +3294,10 @@ static struct iommu_device *intel_iommu_probe_device(struct device *dev)
>
> dev_iommu_priv_set(dev, info);
> if (pdev && pci_ats_supported(pdev)) {
> - pci_prepare_ats(pdev, VTD_PAGE_SHIFT);
> + ret = pci_prepare_ats(pdev, VTD_PAGE_SHIFT);
> + if (ret)
> + goto free;
> +
> ret = device_rbtree_insert(iommu, info);
> if (ret)
> goto free;
[Severity: High]
This is a pre-existing issue, but unconditional rbtree removal of an unlinked
node on error paths in intel_iommu_probe_device() empties the device
tracking tree.
If a device does not support ATS, it skips the device_rbtree_insert() call
above. If a subsequent failure occurs, such as intel_pasid_alloc_table()
failing, the error path jumps to clear_rbtree and unconditionally calls
device_rbtree_remove():
intel_iommu_probe_device() {
...
clear_rbtree:
device_rbtree_remove(info);
}
This function directly invokes rb_erase() without verifying whether the node
is actually linked to the tree:
device_rbtree_remove() {
...
rb_erase(&info->node, &iommu->device_rbtree);
}
Because the node is unlinked and completely zero-initialized, the parent
pointer evaluates to NULL. The rbtree implementation treats the node as the
tree's root and overwrites the root with NULL, completely clearing the IOMMU
device tracking tree.
Could we add a check to verify the node is actually linked before calling
rb_erase(), or only jump to clear_rbtree if the node was successfully
inserted?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260604182116.3179005-1-praan@google.com?part=4
next prev parent reply other threads:[~2026-06-04 18:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-04 18:21 [PATCH v8 0/4] iommu: Standardize ATS robustness and state tracking Pranjal Shrivastava
2026-06-04 18:21 ` [PATCH v8 1/4] PCI/ATS: Ensure pci_ats_supported() is PF-aware for VFs Pranjal Shrivastava
2026-06-04 18:21 ` [PATCH v8 2/4] PCI/ATS: Validate STU for VFs in pci_prepare_ats() Pranjal Shrivastava
2026-06-04 18:21 ` [PATCH v8 3/4] iommu/arm-smmu-v3: Standardize ATS enablement failure reporting Pranjal Shrivastava
2026-06-04 18:33 ` sashiko-bot
2026-06-04 20:33 ` Nicolin Chen
2026-06-05 16:18 ` Samiullah Khawaja
2026-06-04 18:21 ` [PATCH v8 4/4] iommu/vt-d: Fail probe on ATS configuration failure Pranjal Shrivastava
2026-06-04 18:34 ` sashiko-bot [this message]
2026-06-05 16:20 ` Samiullah Khawaja
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=20260604183452.DFD021F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=praan@google.com \
--cc=sashiko-reviews@lists.linux.dev \
/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.