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: <dd05361e-39a2-b8f4-d30a-38ce96799982@linux.intel.com>
Date: Thu, 22 Jan 2026 12:07:40 +0200 (EET)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Bjorn Helgaas <bhelgaas@...gle.com>
cc: Ville Syrjälä <ville.syrjala@...ux.intel.com>, 
    linux-pci@...r.kernel.org, 
    Christian König <christian.koenig@....com>, 
    LKML <linux-kernel@...r.kernel.org>, stable@...r.kernel.org
Subject: Re: [PATCH 1/2] PCI: Fix BAR resize rollback path overwriting ret

On Wed, 21 Jan 2026, Ilpo Järvinen wrote:

> The commit 337b1b566db0 ("PCI: Fix restoring BARs on BAR resize
> rollback path") added BAR rollback to
> pci_do_resource_release_and_resize() in case of resize failure.
> 
> On the rollback, pci_claim_resource() is called which can fail and the
> code is prepared for that possibility. pci_claim_resource()'s return
> value, however, overwrites the original value of ret so
> pci_claim_resource() will return incorrect value in the end (as

Hi Bjorn,

I noticed this should have been:

"pci_do_resource_release_and_resize() will return incorrect value in the 
end ..."

(used a wrong function name).

Could you please adjust the commit message in your tree if it's not too 
late yet?

I'm sorry about the extra hassle.

--
 i.

> pci_claim_resource() normally succeeds, in practice ret will be 0).
> 
> Fix the issue by directly calling pci_claim_resource() inside the if ().
> 
> Fixes: 337b1b566db0 ("PCI: Fix restoring BARs on BAR resize rollback path")
> Link: https://lore.kernel.org/linux-pci/aW_w1oFQCzUxGYtu@intel.com/
> Cc: stable@...r.kernel.org
> Reported-by: Ville Syrjälä <ville.syrjala@...ux.intel.com>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
> ---
>  drivers/pci/setup-bus.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
> index 6e90f46f52af..9c374feafc77 100644
> --- a/drivers/pci/setup-bus.c
> +++ b/drivers/pci/setup-bus.c
> @@ -2556,8 +2556,7 @@ int pci_do_resource_release_and_resize(struct pci_dev *pdev, int resno, int size
>  
>  		restore_dev_resource(dev_res);
>  
> -		ret = pci_claim_resource(dev, i);
> -		if (ret)
> +		if (pci_claim_resource(dev, i))
>  			continue;
>  
>  		if (i < PCI_BRIDGE_RESOURCES) {
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ