Skip to content

Commit f674cb0

Browse files
visitorckwgregkh
authored andcommitted
interconnect: debugfs: Fix incorrect error handling for NULL path
[ Upstream commit 6bfe104 ] The icc_commit_set() function, used by the debugfs interface, checks the validity of the global cur_path pointer using IS_ERR_OR_NULL(). However, in the specific case where cur_path is NULL, while IS_ERR_OR_NULL(NULL) correctly evaluates to true, the subsequent call to PTR_ERR(NULL) returns 0. This causes the function to return a success code (0) instead of an error, misleading the user into believing their bandwidth request was successfully committed when, in fact, no operation was performed. Fix this by adding an explicit check to return -EINVAL if cur_path is NULL. This prevents silent failures and ensures that an invalid operational sequence is immediately and clearly reported as an error. Fixes: 770c69f ("interconnect: Add debugfs test client") Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com> Link: https://lore.kernel.org/r/20251010151447.2289779-1-visitorckw@gmail.com Signed-off-by: Georgi Djakov <djakov@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent b528a34 commit f674cb0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/interconnect/debugfs-client.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,12 @@ static int icc_commit_set(void *data, u64 val)
117117

118118
mutex_lock(&debugfs_lock);
119119

120-
if (IS_ERR_OR_NULL(cur_path)) {
120+
if (!cur_path) {
121+
ret = -EINVAL;
122+
goto out;
123+
}
124+
125+
if (IS_ERR(cur_path)) {
121126
ret = PTR_ERR(cur_path);
122127
goto out;
123128
}

0 commit comments

Comments
 (0)