[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240822032108.1223332-1-11162571@vivo.com>
Date: Thu, 22 Aug 2024 11:21:08 +0800
From: Yang Ruibin <11162571@...o.com>
To: "Rafael J. Wysocki" <rafael@...nel.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Zhang Rui <rui.zhang@...el.com>,
Lukasz Luba <lukasz.luba@....com>,
Stephen Rothwell <sfr@...b.auug.org.au>,
Yang Ruibin <11162571@...o.com>,
linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: opensource.kernel@...o.com
Subject: [PATCH v1] drivers:testing:Handle possible memory leaks
When copy_from_user() fails, -EFAULT is returned without
releasing the memory previously allocated by kmalloc().
Signed-off-by: Yang Ruibin <11162571@...o.com>
---
drivers/thermal/testing/command.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/thermal/testing/command.c b/drivers/thermal/testing/command.c
index 6771eb7b1..7868caee3 100644
--- a/drivers/thermal/testing/command.c
+++ b/drivers/thermal/testing/command.c
@@ -151,6 +151,7 @@ static ssize_t tt_command_process(struct dentry *dentry, const char __user *user
return -ENOMEM;
if (copy_from_user(buf, user_buf, count))
+ kfree(buf);
return -EFAULT;
buf[count] = '\0';
--
2.34.1
Powered by blists - more mailing lists