[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250625-icc-dyn-id-fix-v1-1-127cb5498449@gmail.com>
Date: Wed, 25 Jun 2025 15:34:23 +0200
From: Gabor Juhos <j4g8y7@...il.com>
To: Georgi Djakov <djakov@...nel.org>,
Raviteja Laggyshetty <quic_rlaggysh@...cinc.com>
Cc: linux-pm@...r.kernel.org, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org, Gabor Juhos <j4g8y7@...il.com>
Subject: [PATCH] interconnect: increase ICC_DYN_ID_START
Since commit d30f83d278a9 ("interconnect: core: Add dynamic id allocation
support"), interconnect node ids greater than or equal to ICC_DYN_ID_START
are reserved for dynamic id allocation. Yet the icc_node_create_nolock()
function allows to directly use such ids for creating nodes. This can
cause problems by executing dynamic id related codepaths even for nodes
intended to use static ids.
For example, the 'nsscc-ipq9574' driver creates interconnect nodes with
static ids starting from 19148. Because these ids belongs to the dynamic
id range, the icc_node_add() function replaces the node names
unexpectedly.
The node names looked like this before the change:
# grep nss_cc /sys/kernel/debug/interconnect/interconnect_summary
nss_cc_nssnoc_ppe_clk_master 0 0
nss_cc_nssnoc_ppe_clk_slave 0 0
nss_cc_nssnoc_ppe_cfg_clk_master 0 0
...
And those have an unexpected suffix now:
# grep nss_cc /sys/kernel/debug/interconnect/interconnect_summary
nss_cc_nssnoc_ppe_clk_master@...00000.clock-controller 0 0
nss_cc_nssnoc_ppe_clk_slave@...00000.clock-controller 0 0
nss_cc_nssnoc_ppe_cfg_clk_master@...00000.clock-controller 0 0
...
Increase the value of ICC_DYN_ID_START to avoid this.
Also, add sanity check to the icc_node_create_nolock() function to prevent
directly creating nodes with ids reserved for dynamic allocation in order
to detect these kind of problems.
Fixes: d30f83d278a9 ("interconnect: core: Add dynamic id allocation support")
Signed-off-by: Gabor Juhos <j4g8y7@...il.com>
---
drivers/interconnect/core.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
index 1a41e59c77f85a811f78986e98401625f4cadfa3..3a41b2717edd995d0fb864bbea005a827a33c87a 100644
--- a/drivers/interconnect/core.c
+++ b/drivers/interconnect/core.c
@@ -20,7 +20,7 @@
#include "internal.h"
-#define ICC_DYN_ID_START 10000
+#define ICC_DYN_ID_START 100000
#define CREATE_TRACE_POINTS
#include "trace.h"
@@ -819,6 +819,9 @@ static struct icc_node *icc_node_create_nolock(int id)
{
struct icc_node *node;
+ if (id >= ICC_DYN_ID_START)
+ return ERR_PTR(-EINVAL);
+
/* check if node already exists */
node = node_find(id);
if (node)
---
base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
change-id: 20250619-icc-dyn-id-fix-ddf1699f9ce1
Best regards,
--
Gabor Juhos <j4g8y7@...il.com>
Powered by blists - more mailing lists