ACPI: bus: Call kobject_put() in acpi_init() error path
authorHanjun Guo <guohanjun@huawei.com>
Wed, 2 Jun 2021 09:36:50 +0000 (17:36 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 7 Jun 2021 13:44:26 +0000 (15:44 +0200)
Although the system will not be in a good condition or it will not
boot if acpi_bus_init() fails, it is still necessary to put the
kobject in the error path before returning to avoid leaking memory.

Signed-off-by: Hanjun Guo <guohanjun@huawei.com>
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/bus.c

index a2e814a..c69470e 100644 (file)
@@ -1330,6 +1330,7 @@ static int __init acpi_init(void)
 
        result = acpi_bus_init();
        if (result) {
+               kobject_put(acpi_kobj);
                disable_acpi();
                return result;
        }