summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utils.c
diff options
context:
space:
mode:
authorXiongfeng Wang <wangxiongfeng2@huawei.com>2017-11-09 07:22:39 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-11-14 12:54:55 +0100
commit09e15086936e01d7588020be37ea724116bcefec (patch)
treece0437f6abeba91906df5b02bfea71857f86a927 /drivers/acpi/utils.c
parentMerge tag 'acpi-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ra... (diff)
downloadlinux-09e15086936e01d7588020be37ea724116bcefec.tar.xz
linux-09e15086936e01d7588020be37ea724116bcefec.zip
ACPI / utils: Fix memory leak in acpi_evaluate_reference() error path
When package.count is larger than ACPI_MAX_HANDLES, buffer.pointer is not freed before the function returns AE_NO_MEMORY. Fix this possible memory leak by kfree'ing it. Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/utils.c')
-rw-r--r--drivers/acpi/utils.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index 0a9e5979aaa9..9d49a1acebe3 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -355,6 +355,7 @@ acpi_evaluate_reference(acpi_handle handle,
}
if (package->package.count > ACPI_MAX_HANDLES) {
+ kfree(package);
return AE_NO_MEMORY;
}
list->count = package->package.count;