lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e6641952-ecc2-3f91-1ba8-e1b2c01cf624@linux.intel.com>
Date: Tue, 10 Feb 2026 17:19:35 +0200 (EET)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Kai-Heng Feng <kaihengf@...dia.com>
cc: bhelgaas@...gle.com, linux-pci@...r.kernel.org, 
    LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] PCI: Validate window resource type in
 pbus_select_window_for_type()

On Tue, 10 Feb 2026, Kai-Heng Feng wrote:

> Afer commit ebe091ad81e1 ("PCI: Use pbus_select_window_for_type() during
> IO window sizing") and commit ae88d0b9c57f ("PCI: Use
> pbus_select_window_for_type() during mem window sizing"), many bridge
> window can't get resource assigned:
> pci 0006:05:00.0: bridge window [??? 0x00001000-0x00001fff flags 0x20080000]: can't assign; no space
> pci 0006:05:00.0: bridge window [??? 0x00001000-0x00001fff flags 0x20080000]: failed to assign
> pci 0006:05:04.0: bridge window [??? 0x00001000-0x00001fff flags 0x20080000]: can't assign; no space
> pci 0006:05:04.0: bridge window [??? 0x00001000-0x00001fff flags 0x20080000]: failed to assign
> pci 0006:05:08.0: bridge window [??? 0x00001000-0x00001fff flags 0x20080000]: can't assign; no space
> pci 0006:05:08.0: bridge window [??? 0x00001000-0x00001fff flags 0x20080000]: failed to assign
> pci 0006:05:0c.0: bridge window [??? 0x00001000-0x00001fff flags 0x20080000]: can't assign; no space
> pci 0006:05:0c.0: bridge window [??? 0x00001000-0x00001fff flags 0x20080000]: failed to assign
> 
> Those commits replace find_bus_resource_of_type() with
> pbus_select_window_for_type(), and the latter lacks resource type
> validation.
> 
> This commit adds the resource type validation back to
> pbus_select_window_for_type() to match the original behavior.
> 
> Fixes: 74afce3dfcba ("PCI: Add bridge window selection functions")
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=221072
> Signed-off-by: Kai-Heng Feng <kaihengf@...dia.com>
> ---
>  drivers/pci/setup-bus.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
> index e680f75a5b5e..1b5185697011 100644
> --- a/drivers/pci/setup-bus.c
> +++ b/drivers/pci/setup-bus.c
> @@ -224,14 +224,21 @@ static struct resource *pbus_select_window_for_type(struct pci_bus *bus,
>  
>  	switch (iores_type) {
>  	case IORESOURCE_IO:
> -		return pci_bus_resource_n(bus, PCI_BUS_BRIDGE_IO_WINDOW);
> +		win = pci_bus_resource_n(bus, PCI_BUS_BRIDGE_IO_WINDOW);
> +		if (win && (win->flags & IORESOURCE_IO))
> +			return win;
> +		return NULL;
>  
>  	case IORESOURCE_MEM:
>  		mmio = pci_bus_resource_n(bus, PCI_BUS_BRIDGE_MEM_WINDOW);
>  		mmio_pref = pci_bus_resource_n(bus, PCI_BUS_BRIDGE_PREF_MEM_WINDOW);
>  
> -		if (!(type & IORESOURCE_PREFETCH) ||
> -		    !(mmio_pref->flags & IORESOURCE_MEM))
> +		if (mmio && !(mmio->flags & IORESOURCE_MEM))
> +			mmio = NULL;
> +		if (mmio_pref && !(mmio_pref->flags & IORESOURCE_MEM))
> +			mmio_pref = NULL;
> +
> +		if (!(type & IORESOURCE_PREFETCH) || !mmio_pref)
>  			return mmio;
>  
>  		if ((type & IORESOURCE_MEM_64) ||

Thanks for fixing this,

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>

-- 
 i.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ