Devicetree
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org,
	 linux-pci@vger.kernel.org
Subject: Re: [PATCH v8 4/6] PCI: tegra: Add Tegra264 support
Date: Mon, 27 Jul 2026 18:57:44 +0200	[thread overview]
Message-ID: <ameNj2Gh8mgqL7kB@orome> (raw)
In-Reply-To: <20260716171946.E85D71F000E9@smtp.kernel.org>

[-- Attachment #1: Type: text/plain, Size: 1537 bytes --]

On Thu, Jul 16, 2026 at 05:19:46PM +0000, sashiko-bot@kernel.org wrote:
[...]
> > +	}
> > +
> > +	/* sanity check that programmed ranges match what's in DT */
> > +	if (!tegra264_pcie_check_ranges(pdev)) {
> > +		err = -EINVAL;
> > +		goto err_put_pm;
> > +	}
> > +
> > +	pcie->cfg = pci_ecam_create(dev, res, bus->res, &pci_generic_ecam_ops);
> > +	if (IS_ERR(pcie->cfg)) {
> > +		err = dev_err_probe(dev, PTR_ERR(pcie->cfg),
> > +				    "failed to create ECAM\n");
> > +		goto err_put_pm;
> > +	}
> > +
> > +	bridge->ops = (struct pci_ops *)&pci_generic_ecam_ops.pci_ops;
> > +	bridge->sysdata = pcie->cfg;
> > +	pcie->ecam = pcie->cfg->win;
>         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> [Severity: High]
> Can this assignment cause an out-of-bounds heap read on 32-bit platforms?
> 
> If the driver is compiled on a 32-bit architecture (e.g. via COMPILE_TEST)
> where per_bus_mapping is true, the pci_config_window->win union aliases the
> dynamically allocated cfg->winp array pointer.
> 
> When the driver later dereferences pcie->ecam using readw() in
> tegra264_pcie_link_up():
> 
>     u16 value = readw(pcie->ecam + XTL_RC_PCIE_CFG_LINK_STATUS);
> 
> It will read from the heap array pointer instead of mapped I/O memory,
> resulting in a crash or garbage read.

For the record: no I don't think this is ever going to happen. Yes, if
you build the driver on 32-bit ARM it might generate code that is wrong,
but that code will also never run because Tegra264 is only 64-bit ARM.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2026-07-27 16:57 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16 17:07 [PATCH v8 0/6] PCI: tegra: Add Tegra264 support Thierry Reding
2026-07-16 17:07 ` [PATCH v8 1/6] dt-bindings: pci: tegra264: Strictly distinguish C0 from C1-C5 Thierry Reding
2026-07-16 17:20   ` sashiko-bot
2026-07-16 17:07 ` [PATCH v8 2/6] dt-bindings: pci: tegra264: Switch to PCIe root port bindings Thierry Reding
2026-07-16 17:12   ` sashiko-bot
2026-07-22 17:53   ` Rob Herring
2026-07-16 17:07 ` [PATCH v8 3/6] PCI: Use standard wait times for PCIe link monitoring Thierry Reding
2026-07-16 17:33   ` sashiko-bot
2026-07-29 20:32   ` Bjorn Helgaas
2026-07-16 17:07 ` [PATCH v8 4/6] PCI: tegra: Add Tegra264 support Thierry Reding
2026-07-16 17:19   ` sashiko-bot
2026-07-27 16:57     ` Thierry Reding [this message]
2026-07-22 16:44   ` Bjorn Helgaas
2026-07-27 15:39     ` Thierry Reding
2026-07-24  8:28   ` Manikanta Maddireddy
2026-07-27 15:44     ` Thierry Reding
2026-07-28  3:55       ` Manikanta Maddireddy
2026-07-29 14:26         ` Manivannan Sadhasivam
2026-07-16 17:07 ` [PATCH v8 5/6] arm64: tegra: Reorder reg and reg-names to match bindings Thierry Reding
2026-07-16 17:13   ` sashiko-bot
2026-07-16 17:07 ` [PATCH v8 6/6] arm64: tegra: Add PCIe root ports on Tegra264 Thierry Reding
2026-07-16 17:17   ` sashiko-bot
2026-07-29 14:38 ` (subset) [PATCH v8 0/6] PCI: tegra: Add Tegra264 support Manivannan Sadhasivam

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=ameNj2Gh8mgqL7kB@orome \
    --to=thierry.reding@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox