From: Andy Shevchenko Date: Mon, 18 Mar 2019 18:47:09 +0000 (+0300) Subject: ACPI / utils: Drop reference in test for device presence X-Git-Tag: Ubuntu-4.15.0-61.68~2206 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=ec38cc70c0fd70e412c631cb4927260ed0412c61;p=mirror_ubuntu-bionic-kernel.git ACPI / utils: Drop reference in test for device presence BugLink: https://bugs.launchpad.net/bugs/1838349 [ Upstream commit 54e3aca84e571559915998aa6cc05e5ac37c043b ] When commit 8661423eea1a ("ACPI / utils: Add new acpi_dev_present helper") introduced acpi_dev_present(), it missed the fact that bus_find_device() took a reference on the device found by it and the callers of acpi_dev_present() don't drop that reference. Drop the reference on the device in acpi_dev_present(). Fixes: 8661423eea1a ("ACPI / utils: Add new acpi_dev_present helper") Signed-off-by: Andy Shevchenko Reviewed-by: Hans de Goede Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Signed-off-by: Kamal Mostafa Signed-off-by: Khalid Elmously --- diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 9d49a1acebe3..4472047c1ffb 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -799,6 +799,7 @@ bool acpi_dev_present(const char *hid, const char *uid, s64 hrv) dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_present_cb); + put_device(dev); return !!dev; } EXPORT_SYMBOL(acpi_dev_present);