From: Su Hui <suhui@nfschina.com>
To: sudeep.holla@arm.com, cristian.marussi@arm.com,
nathan@kernel.org, ndesaulniers@google.com, morbo@google.com,
justinstitt@google.com
Cc: Su Hui <suhui@nfschina.com>,
arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
kernel-janitors@vger.kernel.org
Subject: [PATCH] firmware: arm_scmi: fix the double free in scmi_debugfs_common_setup()
Date: Fri, 11 Oct 2024 18:40:02 +0800 [thread overview]
Message-ID: <20241011104001.1546476-1-suhui@nfschina.com> (raw)
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@nfschina.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
next reply other threads:[~2024-10-11 10:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-11 10:40 Su Hui [this message]
2024-10-11 14:25 ` [PATCH] firmware: arm_scmi: fix the double free in scmi_debugfs_common_setup() Cristian Marussi
2024-10-15 13:15 ` Sudeep Holla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241011104001.1546476-1-suhui@nfschina.com \
--to=suhui@nfschina.com \
--cc=arm-scmi@vger.kernel.org \
--cc=cristian.marussi@arm.com \
--cc=justinstitt@google.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=sudeep.holla@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox