Skip to content

Commit 39b13dc

Browse files
Su Huisudeep-holla
authored andcommitted
firmware: arm_scmi: Fix the double free in scmi_debugfs_common_setup()
Clang static checker(scan-build) throws below warning: | drivers/firmware/arm_scmi/driver.c:line 2915, column 2 | Attempt to free released memory. When devm_add_action_or_reset() fails, scmi_debugfs_common_cleanup() will run twice which causes double free of 'dbg->name'. Remove the redundant scmi_debugfs_common_cleanup() to fix this problem. Fixes: c3d4aed ("firmware: arm_scmi: Populate a common SCMI debugfs root") Signed-off-by: Su Hui <[email protected]> Reviewed-by: Cristian Marussi <[email protected]> Message-Id: <[email protected]> Signed-off-by: Sudeep Holla <[email protected]>
1 parent 9852d85 commit 39b13dc

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/firmware/arm_scmi/driver.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2976,10 +2976,8 @@ static struct scmi_debug_info *scmi_debugfs_common_setup(struct scmi_info *info)
29762976
dbg->top_dentry = top_dentry;
29772977

29782978
if (devm_add_action_or_reset(info->dev,
2979-
scmi_debugfs_common_cleanup, dbg)) {
2980-
scmi_debugfs_common_cleanup(dbg);
2979+
scmi_debugfs_common_cleanup, dbg))
29812980
return NULL;
2982-
}
29832981

29842982
return dbg;
29852983
}

0 commit comments

Comments
 (0)