Skip to content

Commit

Permalink
ACPI / utils: Fix memory leak in acpi_evaluate_reference() error path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Xiongfeng Wang authored and Rafael J. Wysocki committed Nov 14, 2017
1 parent 04ed510 commit 09e1508
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/acpi/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 09e1508

Please sign in to comment.