ACPI: bus: Call kobject_put() in acpi_init() error path

[ Upstream commit 4ac7a817f1 ]

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>
This commit is contained in:
Hanjun Guo
2021-07-20 16:17:33 +02:00
committed by Greg Kroah-Hartman
parent a5a48c3565
commit 8b8b93704b
+1
View File
@@ -1249,6 +1249,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;
}