* [PATCH 1/1] coresight: Fix the ACPI memory leak
@ 2023-08-15 12:28 Junhao He
0 siblings, 0 replies; only message in thread
From: Junhao He @ 2023-08-15 12:28 UTC (permalink / raw)
To: suzuki.poulose, mike.leach, leo.yan, james.clark
Cc: coresight, linux-arm-kernel, linux-kernel, linuxarm,
jonathan.cameron, yangyicong, prime.zeng, hejunhao3
The ACPI buffer memory (buf.pointer) should be freed as the buffer
is not used after returning from acpi_get_dsd_graph(), free it to
prevent memory leak.
Fixes: 76ffa5ab5b79 ("coresight: Support for ACPI bindings")
Signed-off-by: Junhao He <hejunhao3@huawei.com>
---
drivers/hwtracing/coresight/coresight-platform.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
index 3e2e135cb8f6..c61cac5e058e 100644
--- a/drivers/hwtracing/coresight/coresight-platform.c
+++ b/drivers/hwtracing/coresight/coresight-platform.c
@@ -524,12 +524,15 @@ acpi_get_dsd_graph(struct acpi_device *adev)
/* Skip the non-Graph _DSD packages */
if (!is_acpi_dsd_graph_guid(guid))
continue;
- if (acpi_validate_dsd_graph(package))
+ if (acpi_validate_dsd_graph(package)) {
+ ACPI_FREE(buf.pointer);
return package;
+ }
/* Invalid graph format, continue */
dev_warn(&adev->dev, "Invalid Graph _DSD property\n");
}
+ ACPI_FREE(buf.pointer);
return NULL;
}
--
2.33.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-08-15 12:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-15 12:28 [PATCH 1/1] coresight: Fix the ACPI memory leak Junhao He
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®