Commit 17cac70b authored by Qiushi Wu's avatar Qiushi Wu Committed by Greg Kroah-Hartman

ACPI: CPPC: Fix reference count leak in acpi_cppc_processor_probe()

commit 4d8be4bc upstream.

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 "b8eb7183" fixed a similar problem.

Fixes: 158c998e ("ACPI / CPPC: add sysfs support to compute delivered performance")
Signed-off-by: default avatarQiushi Wu <wu000273@umn.edu>
Cc: 4.10+ <stable@vger.kernel.org> # 4.10+
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bdce4933
......@@ -793,8 +793,10 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
ret = kobject_init_and_add(&cpc_ptr->kobj, &cppc_ktype, &cpu_dev->kobj,
"acpi_cppc");
if (ret)
if (ret) {
kobject_put(&cpc_ptr->kobj);
goto out_free;
}
kfree(output.pointer);
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment