ACPI: sysfs: Fix reference count leak in acpi_sysfs_add_hotplug_profile()
authorQiushi Wu <wu000273@umn.edu>
Wed, 27 May 2020 21:17:17 +0000 (16:17 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Jun 2020 08:24:09 +0000 (10:24 +0200)
commitbdce493344432a5ce4afa45e6ec8d14edd8dd468
tree22ae2d60756f4f5336fbfc1ebb5f713374477fd4
parentf4df2c5f97951b1767005e79bd7d5897694539c0
ACPI: sysfs: Fix reference count leak in acpi_sysfs_add_hotplug_profile()

commit 6e6c25283dff866308c87b49434c7dbad4774cc0 upstream.

kobject_init_and_add() takes reference even when it fails.
Thus, when kobject_init_and_add() returns an error,
kobject_put() must be called to properly clean up the kobject.

Fixes: 3f8055c35836 ("ACPI / hotplug: Introduce user space interface for hotplug profiles")
Signed-off-by: Qiushi Wu <wu000273@umn.edu>
Cc: 3.10+ <stable@vger.kernel.org> # 3.10+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/acpi/sysfs.c