From: Junhao He <hejunhao3@huawei.com>
To: <suzuki.poulose@arm.com>, <mike.leach@linaro.org>,
<leo.yan@linaro.org>, <james.clark@arm.com>
Cc: <coresight@lists.linaro.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <linuxarm@huawei.com>,
<jonathan.cameron@huawei.com>, <yangyicong@huawei.com>,
<prime.zeng@hisilicon.com>, <hejunhao3@huawei.com>
Subject: [PATCH 1/1] coresight: Fix the ACPI memory leak
Date: Tue, 15 Aug 2023 20:28:03 +0800 [thread overview]
Message-ID: <20230815122803.29295-1-hejunhao3@huawei.com> (raw)
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
reply other threads:[~2023-08-15 12:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230815122803.29295-1-hejunhao3@huawei.com \
--to=hejunhao3@huawei.com \
--cc=coresight@lists.linaro.org \
--cc=james.clark@arm.com \
--cc=jonathan.cameron@huawei.com \
--cc=leo.yan@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=mike.leach@linaro.org \
--cc=prime.zeng@hisilicon.com \
--cc=suzuki.poulose@arm.com \
--cc=yangyicong@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®