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: <CAJZ5v0j2a803ye6KYzM9dZ_inCTqiwmN7UvAdYeynk+A9F97Fg@mail.gmail.com>
Date:   Thu, 8 Apr 2021 17:18:46 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Zhiqiang Liu <liuzhiqiang26@...wei.com>,
        Bjorn Helgaas <bhelgaas@...gle.com>
Cc:     "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Len Brown <lenb@...nel.org>,
        ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
        Linux PCI <linux-pci@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        linfeilong <linfeilong@...wei.com>
Subject: Re: [PATCH v2] ACPI / hotplug / PCI: fix memory leak in enable_slot()

On Thu, Mar 25, 2021 at 8:27 AM Zhiqiang Liu <liuzhiqiang26@...wei.com> wrote:
>
> From: Feilong Lin <linfeilong@...wei.com>
>
> In enable_slot() in drivers/pci/hotplug/acpiphp_glue.c, if pci_get_slot()
> will return NULL, we will do not set SLOT_ENABLED flag of slot. if one
> device is found by calling pci_get_slot(), its reference count will be
> increased. In this case, we did not call pci_dev_put() to decrement the
> its reference count, the memory of the device (struct pci_dev type) will
> leak.
>
> Fix it by calling pci_dev_put() to decrement its reference count after that
> pci_get_slot() returns a PCI device.
>
> Signed-off-by: Feilong Lin <linfeilong@...wei.com>
> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@...wei.com>
> --
> v2: rewrite subject and commit log as suggested by Bjorn Helgaas.

The fix is correct AFAICS, so

Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>

Bjorn, has this been applied already?  If not, do you want me to take
it or are you going to queue it up yourself?

> ---
>  drivers/pci/hotplug/acpiphp_glue.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
> index 3365c93abf0e..f031302ad401 100644
> --- a/drivers/pci/hotplug/acpiphp_glue.c
> +++ b/drivers/pci/hotplug/acpiphp_glue.c
> @@ -533,6 +533,7 @@ static void enable_slot(struct acpiphp_slot *slot, bool bridge)
>                         slot->flags &= ~SLOT_ENABLED;
>                         continue;
>                 }
> +               pci_dev_put(dev);
>         }
>  }
>
> --
> 2.19.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ