From: sashiko-bot@kernel.org
To: "Angel J" <iamanaws@httpd.dev>
Cc: robh@kernel.org, devicetree@vger.kernel.org,
linux-pci@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2] PCI: of_property: Omit bus properties without a subordinate bus
Date: Sat, 12 Sep 2026 04:42:35 +0000 [thread overview]
Message-ID: <20260912044236.3D4581F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260912043106.10715-1-iamanaws@httpd.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Potential kernel panic due to unhandled kasprintf() memory allocation failure in of_pci_prop_compatible().
--
commit ad6194f8ec3f58cf7279c3746e014412e0aad530
Author: Angel J <iamanaws@httpd.dev>
PCI: of_property: Omit bus properties without a subordinate bus
This commit updates of_pci_add_properties() to only generate bus-range and
interrupt-map properties when a subordinate bus is present. This prevents an
early boot hang on devices that satisfy pci_is_bridge() but lack a
subordinate bus.
> diff --git a/drivers/pci/of_property.c b/drivers/pci/of_property.c
> index 75a358f73e694..acd2e0f70f01b 100644
> --- a/drivers/pci/of_property.c
> +++ b/drivers/pci/of_property.c
> @@ -361,13 +361,15 @@ int of_pci_add_properties(struct pci_dev *pdev, struct of_changeset *ocs,
> if (ret)
> return ret;
>
> - ret = of_pci_prop_bus_range(pdev, ocs, np);
> - if (ret)
> - return ret;
> + if (pdev->subordinate) {
> + ret = of_pci_prop_bus_range(pdev, ocs, np);
> + if (ret)
> + return ret;
>
> - ret = of_pci_prop_intr_map(pdev, ocs, np);
> - if (ret)
> - return ret;
> + ret = of_pci_prop_intr_map(pdev, ocs, np);
> + if (ret)
> + return ret;
> + }
> } else {
> ret = of_pci_prop_intr_ctrl(pdev, ocs, np);
> if (ret)
[Severity: High]
This is a pre-existing issue, but I noticed a potential problem in
of_pci_prop_compatible(), which is called later in this same function.
Can kasprintf() return NULL here under memory pressure?
drivers/pci/of_property.c:of_pci_prop_compatible() {
...
compat_strs[PROP_COMPAT_PCI_VVVV_DDDD] =
kasprintf(GFP_KERNEL, "pci%x,%x", pdev->vendor, pdev->device);
...
}
If this happens, the compat_strs array will contain a NULL pointer.
When this array is passed to of_changeset_add_prop_string_array():
drivers/pci/of_property.c:of_pci_prop_compatible() {
...
ret = of_changeset_add_prop_string_array(ocs, np, "compatible",
compat_strs, PROP_COMPAT_NUM);
...
}
Does the changeset API assume all string pointers are valid, leading to a
NULL pointer dereference in strlen() when it iterates over the array?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260912043106.10715-1-iamanaws@httpd.dev?part=1
prev parent reply other threads:[~2026-09-12 4:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-23 2:14 [REGRESSION] PCI: Dynamic OF node creation hangs on invalid bridge configuration Angel J
2026-09-01 0:59 ` Angel J
2026-09-01 6:07 ` Thorsten Leemhuis
2026-09-03 23:17 ` Bjorn Helgaas
2026-09-04 8:57 ` Herve Codina
2026-09-09 11:27 ` Andrea della Porta
2026-09-11 23:01 ` Angel J
2026-09-11 23:04 ` [PATCH] PCI: of: Skip dynamic nodes for bridges without a subordinate bus Angel J
2026-09-11 23:13 ` sashiko-bot
2026-09-12 4:31 ` [PATCH v2] PCI: of_property: Omit bus properties " Angel J
2026-09-12 4:42 ` sashiko-bot [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=20260912044236.3D4581F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=iamanaws@httpd.dev \
--cc=linux-pci@vger.kernel.org \
--cc=robh@kernel.org \
--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.