* [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; 2+ messages 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] 2+ messages in thread
* [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; 2+ messages 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] 2+ messages in thread
end of thread, other threads:[~2017-11-09 6:31 UTC | newest]
Thread overview: 2+ messages (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
2017-11-09 6:22 ` Xiongfeng Wang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.