summaryrefslogtreecommitdiff
path: root/drivers/platform
diff options
context:
space:
mode:
authorFeng Jiang <jiangfeng@kylinos.cn>2023-04-12 17:37:34 +0800
committerHans de Goede <hdegoede@redhat.com>2023-04-17 10:27:53 +0200
commitf6e7ac4c35a28aef0be93b32c533ae678ad0b9e7 (patch)
tree74c8b32012243f8332ef3153141a2a1edb646164 /drivers/platform
parent82c3a0b7f0cb97445eeb8b91b0a37d95f8c2c2a9 (diff)
platform/x86/amd: pmc: Fix memory leak in amd_pmc_stb_debugfs_open_v2()
Function amd_pmc_stb_debugfs_open_v2() may be called when the STB debug mechanism enabled. When amd_pmc_send_cmd() fails, the 'buf' needs to be released. Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn> Link: https://lore.kernel.org/r/20230412093734.1126410-1-jiangfeng@kylinos.cn Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/amd/pmc.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/platform/x86/amd/pmc.c b/drivers/platform/x86/amd/pmc.c
index 877b629e5cae..14d3ff425300 100644
--- a/drivers/platform/x86/amd/pmc.c
+++ b/drivers/platform/x86/amd/pmc.c
@@ -265,6 +265,7 @@ static int amd_pmc_stb_debugfs_open_v2(struct inode *inode, struct file *filp)
dev->msg_port = 0;
if (ret) {
dev_err(dev->dev, "error: S2D_NUM_SAMPLES not supported : %d\n", ret);
+ kfree(buf);
return ret;
}