[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3629201.dfk0t3lWhY@vostro.rjw.lan>
Date: Sat, 12 Jan 2013 22:39:14 +0100
From: "Rafael J. Wysocki" <rjw@...k.pl>
To: Yinghai Lu <yinghai@...nel.org>
Cc: Bjorn Helgaas <bhelgaas@...gle.com>, Len Brown <lenb@...nel.org>,
Taku Izumi <izumi.taku@...fujitsu.com>,
Jiang Liu <jiang.liu@...wei.com>, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-acpi@...r.kernel.org
Subject: Re: [PATCH v8 04/22] PCI: Fix a device reference count leakage issue in pci_dev_present()
On Friday, January 11, 2013 02:40:31 PM Yinghai Lu wrote:
> From: Jiang Liu <jiang.liu@...wei.com>
>
> Function pci_get_dev_by_id() will hold a reference count on the pci device
> returned, so pci_dev_present() should release the corresponding reference
> count to avoid memory leakage.
>
> Signed-off-by: Jiang Liu <jiang.liu@...wei.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> ---
> drivers/pci/search.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pci/search.c b/drivers/pci/search.c
> index bf969ba..d0627fa 100644
> --- a/drivers/pci/search.c
> +++ b/drivers/pci/search.c
> @@ -319,13 +319,13 @@ int pci_dev_present(const struct pci_device_id *ids)
> WARN_ON(in_interrupt());
> while (ids->vendor || ids->subvendor || ids->class_mask) {
> found = pci_get_dev_by_id(ids, NULL);
> - if (found)
> - goto exit;
> + if (found) {
> + pci_dev_put(found);
> + return 1;
> + }
> ids++;
> }
> -exit:
> - if (found)
> - return 1;
> +
> return 0;
> }
> EXPORT_SYMBOL(pci_dev_present);
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists