This is a note to let you know that I've just added the patch titled platform/x86/amd: pmc: Fix memory leak in amd_pmc_stb_debugfs_open_v2() to the 6.3-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: platform-x86-amd-pmc-fix-memory-leak-in-amd_pmc_stb_.patch and it can be found in the queue-6.3 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 3fb0f23d5845a1e6236ac5e79e775dfe16c770f9 Author: Feng Jiang <jiangfeng@xxxxxxxxxx> Date: Wed Apr 12 17:37:34 2023 +0800 platform/x86/amd: pmc: Fix memory leak in amd_pmc_stb_debugfs_open_v2() [ Upstream commit f6e7ac4c35a28aef0be93b32c533ae678ad0b9e7 ] 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@xxxxxxxxxx> Link: https://lore.kernel.org/r/20230412093734.1126410-1-jiangfeng@xxxxxxxxxx Reviewed-by: Hans de Goede <hdegoede@xxxxxxxxxx> Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/platform/x86/amd/pmc.c b/drivers/platform/x86/amd/pmc.c index 69f305496643f..73dedc9950144 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; }