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]
Date:   Tue, 14 Feb 2023 10:46:45 +0100
From:   Gerd Bayer <gbayer@...ux.ibm.com>
To:     Niklas Schnelle <schnelle@...ux.ibm.com>
Cc:     linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-pci@...r.kernel.org,
        Gerald Schaefer <gerald.schaefer@...ux.ibm.com>,
        Heiko Carstens <hca@...ux.ibm.com>,
        Vasily Gorbik <gor@...ux.ibm.com>,
        Alexander Gordeev <agordeev@...ux.ibm.com>,
        Christian Borntraeger <borntraeger@...ux.ibm.com>,
        Sven Schnelle <svens@...ux.ibm.com>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        Pierre Morel <pmorel@...ux.ibm.com>,
        Matthew Rosato <mjrosato@...ux.ibm.com>
Subject: Re: [PATCH] PCI: s390: Fix use-after-free of PCI bus resources with
 s390 per-function hotplug

Hi Niklas,

when comparing pci_bus_remove_resource with pci_bus_remove_resources,
I find that the "single-resource" variant might be ending too early.

On Fri, 2023-02-03 at 12:48 +0100, Niklas Schnelle wrote:
> +void pci_bus_remove_resource(struct pci_bus *bus, struct resource
> *res)
> +{
> +       struct pci_bus_resource *bus_res, *tmp;
> +       int i;
> +
> +       for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; i++) {
> +               if (bus->resource[i] == res) {
> +                       bus->resource[i] = NULL;
> +                       return;
                          ^^^^^^^
Did you mean to "break" here, rather than end the routine?
> +               }
> +       }
> +
> +       list_for_each_entry_safe(bus_res, tmp, &bus->resources, list)
> {
> +               if (bus_res->res == res) {
> +                       list_del(&bus_res->list);
> +                       kfree(bus_res);
> +                       return;
                          ^^^^^^^
Here "break" and "return" have the same effect, but "break" would be
"symmetric".
> +               }
> +       }
> +       return;
> +
> +}

While this might be a nit, I'd like to better separate the "single-
resource" variant's name. How about pci_bus_remove_one_resource - I
know it's getting long...

Thanks,
Gerd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ