Re: [PATCH] PCI: probe: Fix 64-bit limit truncation in prefetchable window

From: Mohamad Raizudeen

Date: Wed Sep 16 2026 - 01:10:23 EST


On Fri, Aug 14, 2026 at 10:16:52PM +0530, Mohamad Raizudeen wrote:
> In pci_read_bridge_mmio_pref(), the code checks if the 64 bit base
> address is truncated on 32 bit pci_bus_addr_t. However, it misses this
> same check for the limit address.
>
> If firmware sets a window that starts below 4GB but ends above 4GB, the
> base check passes. But the 64 bit limit is silently cut down to 32 bits
> and wraps around to zero. This makes the base larger than the limit,
> causing the kernel to silently disable the memory window instead of
> printing an error.
>
> Fix this by checking if the limit was truncated, just like the base.
> Also, update the error message to print both the base and limit
> addresses to make debugging easier.
>
> Fixes: 7fc986d8a9727 ("PCI: Support 64-bit bridge windows if we have 64-bit dma_addr_t")
> Signed-off-by: Mohamad Raizudeen <raizudeen.kerneldev@xxxxxxxxx>
> ---
> drivers/pci/probe.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index dd0abbc63e18..0cf2d1d35146 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -479,9 +479,10 @@ static void pci_read_bridge_mmio_pref(struct pci_dev *dev, struct resource *res,
> base = (pci_bus_addr_t) base64;
> limit = (pci_bus_addr_t) limit64;
>
> - if (base != base64) {
> - pci_err(dev, "can't handle bridge window above 4GB (bus address %#010llx)\n",
> - (unsigned long long) base64);
> + if (base != base64 || limit != limit64) {
> + pci_err(dev, "can't handle bridge window above 4GB (bus address %#010llx-%#010llx)\n",
> + (unsigned long long) base64,
> + (unsigned long long) limit64);
> return;
> }
>
> --
> 2.53.0
>
Hi Bjorn,

Just following up on this patch. Please let me know if you have any
feedback or if further changes are needed.

Thanks,
Mohamad Raizudeen