[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241011104001.1546476-1-suhui@nfschina.com>
Date: Fri, 11 Oct 2024 18:40:02 +0800
From: Su Hui <suhui@...china.com>
To: sudeep.holla@....com,
cristian.marussi@....com,
nathan@...nel.org,
ndesaulniers@...gle.com,
morbo@...gle.com,
justinstitt@...gle.com
Cc: Su Hui <suhui@...china.com>,
arm-scmi@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev,
kernel-janitors@...r.kernel.org
Subject: [PATCH] firmware: arm_scmi: fix the double free in scmi_debugfs_common_setup()
Clang static checker(scan-build) warning:
drivers/firmware/arm_scmi/driver.c:line 2915, column 2
Attempt to free released memory.
When devm_add_action_or_reset() failed , scmi_debugfs_common_cleanup()
will run twice which caused double free of 'dbg->name'.
Remove the redundant scmi_debugfs_common_cleanup() to fix this problem.
Fixes: c3d4aed763ce ("firmware: arm_scmi: Populate a common SCMI debugfs root")
Signed-off-by: Su Hui <suhui@...china.com>
---
drivers/firmware/arm_scmi/driver.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index 88c5c4ff4bb6..a477b5ade38d 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -2976,10 +2976,8 @@ static struct scmi_debug_info *scmi_debugfs_common_setup(struct scmi_info *info)
dbg->top_dentry = top_dentry;
if (devm_add_action_or_reset(info->dev,
- scmi_debugfs_common_cleanup, dbg)) {
- scmi_debugfs_common_cleanup(dbg);
+ scmi_debugfs_common_cleanup, dbg))
return NULL;
- }
return dbg;
}
--
2.30.2
Powered by blists - more mailing lists