summaryrefslogtreecommitdiff
path: root/drivers/interconnect
diff options
context:
space:
mode:
authorKuan-Wei Chiu <visitorckw@gmail.com>2025-10-10 23:14:47 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-12-18 13:54:51 +0100
commitf674cb00630ab6d5018fcfa3dae2652699bb66a2 (patch)
tree4fe57f8eeec1b972be505c940450cc9b61e2c319 /drivers/interconnect
parentb528a34aaf487bb91d4db80d48dfc1c3aa28e40f (diff)
downloadlinux-f674cb00630ab6d5018fcfa3dae2652699bb66a2.tar.gz
linux-f674cb00630ab6d5018fcfa3dae2652699bb66a2.tar.bz2
linux-f674cb00630ab6d5018fcfa3dae2652699bb66a2.zip
interconnect: debugfs: Fix incorrect error handling for NULL path
[ Upstream commit 6bfe104fd0f94d0248af22c256ce725ee087157b ] 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: 770c69f037c1 ("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>
Diffstat (limited to 'drivers/interconnect')
-rw-r--r--drivers/interconnect/debugfs-client.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/interconnect/debugfs-client.c b/drivers/interconnect/debugfs-client.c
index bc3fd8a7b9eb..778deeb4a7e8 100644
--- a/drivers/interconnect/debugfs-client.c
+++ b/drivers/interconnect/debugfs-client.c
@@ -117,7 +117,12 @@ static int icc_commit_set(void *data, u64 val)
mutex_lock(&debugfs_lock);
- if (IS_ERR_OR_NULL(cur_path)) {
+ if (!cur_path) {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if (IS_ERR(cur_path)) {
ret = PTR_ERR(cur_path);
goto out;
}