lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251228125226.3684517-1-zilin@seu.edu.cn>
Date: Sun, 28 Dec 2025 12:52:26 +0000
From: Zilin Guan <zilin@....edu.cn>
To: matthias.bgg@...il.com
Cc: angelogioacchino.delregno@...labora.com,
	linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org,
	linux-mediatek@...ts.infradead.org,
	Zilin Guan <zilin@....edu.cn>,
	Jianhao Xu <jianhao.xu@....edu.cn>
Subject: [PATCH] soc: mediatek: SVS: Fix memory leak in svs_enable_debug_write()

In svs_enable_debug_write(), the buf is allocated via memdup_user_nul().
If kstrtoint() fails, the function returns directly without freeing the
allocated memory, leading to a memory leak.

Fix this by freeing buf before returning the error code.

Fixes: 13f1bbcfb582 ("soc: mediatek: SVS: add debug commands")
Co-developed-by: Jianhao Xu <jianhao.xu@....edu.cn>
Signed-off-by: Jianhao Xu <jianhao.xu@....edu.cn>
Signed-off-by: Zilin Guan <zilin@....edu.cn>
---
 drivers/soc/mediatek/mtk-svs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/mediatek/mtk-svs.c b/drivers/soc/mediatek/mtk-svs.c
index f45537546553..691e7e6be654 100644
--- a/drivers/soc/mediatek/mtk-svs.c
+++ b/drivers/soc/mediatek/mtk-svs.c
@@ -799,8 +799,10 @@ static ssize_t svs_enable_debug_write(struct file *filp,
 		return PTR_ERR(buf);
 
 	ret = kstrtoint(buf, 10, &enabled);
-	if (ret)
+	if (ret) {
+		kfree(buf);
 		return ret;
+	}
 
 	if (!enabled) {
 		svs_bank_disable_and_restore_default_volts(svsp, svsb);
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ