]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:21:00 +0000 (16:21 +0200)
[ Upstream commit 4ac7a817f1992103d4e68e9837304f860b5e7300 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/acpi/bus.c

index 6b2c9d68d81070779cc019bbffb5841e61fadbe8..1c13e5fe10d9820ac3a8b2fd0a3438890b388a38 100644 (file)
@@ -1184,6 +1184,7 @@ static int __init acpi_init(void)
        init_acpi_device_notify();
        result = acpi_bus_init();
        if (result) {
+               kobject_put(acpi_kobj);
                disable_acpi();
                return result;
        }