2017-11-09 06:32:28

by Xiongfeng Wang

[permalink] [raw]
Subject: [PATCH] ACPI / utils: Fix memory leak on an error return path in acpi_evaluate_reference()

When package.count is larger than ACPI_MAS_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 <[email protected]>
---
drivers/acpi/utils.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index b9d956c..9282549 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -355,6 +355,7 @@
}

if (package->package.count > ACPI_MAX_HANDLES) {
+ kfree(package);
return AE_NO_MEMORY;
}
list->count = package->package.count;
--
1.7.12.4


From 1583590229542953817@xxx Thu Nov 09 12:08:49 +0000 2017
X-GM-THRID: 1583063028193131710
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread