Skip to content

Commit

Permalink
ACPI: bus: Call kobject_put() in acpi_init() error path
Browse files Browse the repository at this point in the history
[ Upstream commit 4ac7a81 ]

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>
  • Loading branch information
guohanjun authored and gregkh committed Jul 14, 2021
1 parent a8c0057 commit c798522
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/acpi/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,7 @@ static int __init acpi_init(void)

result = acpi_bus_init();
if (result) {
kobject_put(acpi_kobj);
disable_acpi();
return result;
}
Expand Down

0 comments on commit c798522

Please sign in to comment.