All of lore.kernel.org
 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.4 5/7] ACPI: bus: Call kobject_put() in acpi_init() error path
Date: Mon,  5 Jul 2021 11:32:05 -0400	[thread overview]
Message-ID: <20210705153208.1522553-5-sashal@kernel.org> (raw)
In-Reply-To: <20210705153208.1522553-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 521d1b28760c..d016eba51a95 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -1087,6 +1087,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:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-05 15:32 [PATCH AUTOSEL 4.4 1/7] ACPI: processor idle: Fix up C-state latency if not ordered Sasha Levin
2021-07-05 15:32 ` [PATCH AUTOSEL 4.4 2/7] block_dump: remove block_dump feature in mark_inode_dirty() Sasha Levin
2021-07-05 15:32 ` [PATCH AUTOSEL 4.4 3/7] fs: dlm: cancel work sync othercon Sasha Levin
2021-07-05 15:32   ` [Cluster-devel] " Sasha Levin
2021-07-05 15:32 ` [PATCH AUTOSEL 4.4 4/7] random32: Fix implicit truncation warning in prandom_seed_state() Sasha Levin
2021-07-05 15:32 ` Sasha Levin [this message]
2021-07-05 15:32 ` [PATCH AUTOSEL 4.4 6/7] platform/x86: toshiba_acpi: Fix missing error code in toshiba_acpi_setup_keyboard() Sasha Levin
2021-07-05 15:32 ` [PATCH AUTOSEL 4.4 7/7] ia64: mca_drv: fix incorrect array size calculation Sasha Levin
2021-07-05 15:32   ` 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=20210705153208.1522553-5-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.