linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ACPI / utils: Fix memory leak on an error return path in acpi_evaluate_reference()
@ 2017-11-09  6:22 Xiongfeng Wang
  0 siblings, 0 replies; only message in thread
From: Xiongfeng Wang @ 2017-11-09  6:22 UTC (permalink / raw)
  To: rjw; +Cc: linux-kernel, linux-acpi, huawei.libin, hanjun.guo, wangxiongfeng2

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 <wangxiongfeng2@huawei.com>
---
 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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-11-09  6:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-09  6:22 [PATCH] ACPI / utils: Fix memory leak on an error return path in acpi_evaluate_reference() Xiongfeng Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).