[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20230815122803.29295-1-hejunhao3@huawei.com>
Date: Tue, 15 Aug 2023 20:28:03 +0800
From: Junhao He <hejunhao3@...wei.com>
To: <suzuki.poulose@....com>, <mike.leach@...aro.org>,
<leo.yan@...aro.org>, <james.clark@....com>
CC: <coresight@...ts.linaro.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <linuxarm@...wei.com>,
<jonathan.cameron@...wei.com>, <yangyicong@...wei.com>,
<prime.zeng@...ilicon.com>, <hejunhao3@...wei.com>
Subject: [PATCH 1/1] coresight: Fix the ACPI memory leak
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@...wei.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
Powered by blists - more mailing lists