linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ACPI: CPPC: Fix reference count leak in acpi_cppc_processor_probe.
@ 2020-05-27 22:35 wu000273
  2020-05-28 11:49 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: wu000273 @ 2020-05-27 22:35 UTC (permalink / raw)
  To: kjlu
  Cc: wu000273, Rafael J. Wysocki, Len Brown, Prashanth Prakash,
	Ashwin Chaugule, linux-acpi, linux-kernel

From: Qiushi Wu <wu000273@umn.edu>

kobject_init_and_add() takes reference even when it fails.
If this function returns an error, kobject_put() must be called to
properly clean up the memory associated with the object. Previous
commit "b8eb718348b8" fixed a similar problem.

Fixes: 158c998ea44b ("ACPI / CPPC: add sysfs support to compute delivered performance")
Signed-off-by: Qiushi Wu <wu000273@umn.edu>
---
 drivers/acpi/cppc_acpi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
index 8b2e89c20c11..067067bc03d4 100644
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -846,6 +846,7 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
 			"acpi_cppc");
 	if (ret) {
 		per_cpu(cpc_desc_ptr, pr->id) = NULL;
+		kobject_put(&cpc_ptr->kobj);
 		goto out_free;
 	}
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-28 11:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27 22:35 [PATCH] ACPI: CPPC: Fix reference count leak in acpi_cppc_processor_probe wu000273
2020-05-28 11:49 ` Rafael J. Wysocki

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).