Skip to contentSkip to conversation

platform/x86/amd: pmc: Fix memory leak in amd_pmc_stb_debugfs_open_v2()

PATCH New Feng Jiang 1 participant 1 message Apr 12, 2023 x86 platform drivers

lore
Share & tools
lore

Feng Jiang

author
#0 lore raw

PATCH 1/1 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.

---
 drivers/platform/x86/amd/pmc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/platform/x86/amd/pmc.c +1 -0
index 2edaae04a691..91d04e710486 100644
@@ -268,6 +268,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;
 	}
 
Signature · 1 line
2.39.2