Skip to content

Commit 1809db7

Browse files
juhosgGeorgi Djakov
authored andcommitted
interconnect: increase ICC_DYN_ID_START
Since commit d30f83d ("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 [email protected] 0 0 [email protected] 0 0 [email protected] 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: d30f83d ("interconnect: core: Add dynamic id allocation support") Signed-off-by: Gabor Juhos <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Georgi Djakov <[email protected]>
1 parent b44f12a commit 1809db7

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/interconnect/core.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#include "internal.h"
2222

23-
#define ICC_DYN_ID_START 10000
23+
#define ICC_DYN_ID_START 100000
2424

2525
#define CREATE_TRACE_POINTS
2626
#include "trace.h"
@@ -819,6 +819,9 @@ static struct icc_node *icc_node_create_nolock(int id)
819819
{
820820
struct icc_node *node;
821821

822+
if (id >= ICC_DYN_ID_START)
823+
return ERR_PTR(-EINVAL);
824+
822825
/* check if node already exists */
823826
node = node_find(id);
824827
if (node)

0 commit comments

Comments
 (0)