From: Hanjun Guo Date: Wed, 2 Jun 2021 09:36:50 +0000 (+0800) Subject: ACPI: bus: Call kobject_put() in acpi_init() error path X-Git-Tag: v4.9.276~194 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2c62eaa6591b66c46b0d1eaecacfe0c463463bed;p=thirdparty%2Fkernel%2Fstable.git ACPI: bus: Call kobject_put() in acpi_init() error path [ 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 [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 6b2c9d68d8107..1c13e5fe10d98 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -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; }