linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Hanjun Guo <guohanjun@huawei.com>,
	"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	Sasha Levin <sashal@kernel.org>,
	linux-acpi@vger.kernel.org
Subject: [PATCH AUTOSEL 4.14 11/15] ACPI: bus: Call kobject_put() in acpi_init() error path
Date: Mon,  5 Jul 2021 11:31:32 -0400	[thread overview]
Message-ID: <20210705153136.1522245-11-sashal@kernel.org> (raw)
In-Reply-To: <20210705153136.1522245-1-sashal@kernel.org>

From: Hanjun Guo <guohanjun@huawei.com>

[ 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 <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>
---
 drivers/acpi/bus.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 1cb7c6a52f61..7ea02bb50c73 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -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;
 	}
-- 
2.30.2


  parent reply	other threads:[~2021-07-05 15:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-05 15:31 [PATCH AUTOSEL 4.14 01/15] HID: do not use down_interruptible() when unbinding devices Sasha Levin
2021-07-05 15:31 ` [PATCH AUTOSEL 4.14 02/15] ACPI: processor idle: Fix up C-state latency if not ordered Sasha Levin
2021-07-05 15:31 ` [PATCH AUTOSEL 4.14 03/15] hv_utils: Fix passing zero to 'PTR_ERR' warning Sasha Levin
2021-07-05 15:31 ` [PATCH AUTOSEL 4.14 04/15] lib: vsprintf: Fix handling of number field widths in vsscanf Sasha Levin
2021-07-05 15:31 ` [PATCH AUTOSEL 4.14 05/15] ACPI: EC: Make more Asus laptops use ECDT _GPE Sasha Levin
2021-07-05 15:31 ` [PATCH AUTOSEL 4.14 06/15] block_dump: remove block_dump feature in mark_inode_dirty() Sasha Levin
2021-07-05 15:31 ` [PATCH AUTOSEL 4.14 07/15] fs: dlm: cancel work sync othercon Sasha Levin
2021-07-05 15:31 ` [PATCH AUTOSEL 4.14 08/15] random32: Fix implicit truncation warning in prandom_seed_state() Sasha Levin
2021-07-05 15:31 ` [PATCH AUTOSEL 4.14 09/15] fs: dlm: fix memory leak when fenced Sasha Levin
2021-07-05 15:31 ` [PATCH AUTOSEL 4.14 10/15] ACPICA: Fix memory leak caused by _CID repair function Sasha Levin
2021-07-05 15:31 ` Sasha Levin [this message]
2021-07-05 15:31 ` [PATCH AUTOSEL 4.14 12/15] platform/x86: toshiba_acpi: Fix missing error code in toshiba_acpi_setup_keyboard() Sasha Levin
2021-07-05 15:31 ` [PATCH AUTOSEL 4.14 13/15] ACPI: tables: Add custom DSDT file as makefile prerequisite Sasha Levin
2021-07-05 15:31 ` [PATCH AUTOSEL 4.14 14/15] HID: wacom: Correct base usage for capacitive ExpressKey status bits Sasha Levin
2021-07-05 15:31 ` [PATCH AUTOSEL 4.14 15/15] ia64: mca_drv: fix incorrect array size calculation Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210705153136.1522245-11-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=guohanjun@huawei.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).