Blob Blame History Raw
From 4ac7a817f1992103d4e68e9837304f860b5e7300 Mon Sep 17 00:00:00 2001
From: Hanjun Guo <guohanjun@huawei.com>
Date: Wed, 2 Jun 2021 17:36:50 +0800
Subject: [PATCH] ACPI: bus: Call kobject_put() in acpi_init() error path
Git-commit: 4ac7a817f1992103d4e68e9837304f860b5e7300
Patch-mainline: v5.14-rc1
References: git-fixes

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>
Acked-by: Takashi Iwai <tiwai@suse.de>

---
 drivers/acpi/bus.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -1221,6 +1221,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;
 	}