]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ACPI: bus: Bail out if acpi_kobj registration fails
authorArmin Wolf <W_Armin@gmx.de>
Sun, 18 May 2025 18:51:11 +0000 (20:51 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2025 10:07:32 +0000 (11:07 +0100)
[ Upstream commit 94a370fc8def6038dbc02199db9584b0b3690f1a ]

The ACPI sysfs code will fail to initialize if acpi_kobj is NULL,
together with some ACPI drivers.

Follow the other firmware subsystems and bail out if the kobject
cannot be registered.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://patch.msgid.link/20250518185111.3560-2-W_Armin@gmx.de
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/acpi/bus.c

index a16b7de73d16479b20b5f681167099ed3a15df25..fafa15507b1414e7f5e23cd5e1a110676b17ddd6 100644 (file)
@@ -1389,8 +1389,10 @@ static int __init acpi_init(void)
        }
 
        acpi_kobj = kobject_create_and_add("acpi", firmware_kobj);
-       if (!acpi_kobj)
-               pr_debug("%s: kset create error\n", __func__);
+       if (!acpi_kobj) {
+               pr_err("Failed to register kobject\n");
+               return -ENOMEM;
+       }
 
        init_prmt();
        acpi_init_pcc();