Skip to content

Commit ad2ab12

Browse files
Mike TiptonGeorgi Djakov
authored andcommitted
interconnect: Treat xlate() returning NULL node as an error
Currently, if provider->xlate() or provider->xlate_extended() "successfully" return a NULL node, then of_icc_get_from_provider() won't consider that an error and will successfully return the NULL node. This bypasses error handling in of_icc_get_by_index() and leads to NULL dereferences in path_find(). This could be avoided by ensuring provider callbacks always return an error for NULL nodes, but it's better to explicitly protect against this in the common framework. Fixes: 87e3031 ("interconnect: Allow endpoints translation via DT") Signed-off-by: Mike Tipton <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Georgi Djakov <[email protected]>
1 parent b85ea95 commit ad2ab12

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/interconnect/core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,9 @@ struct icc_node_data *of_icc_get_from_provider(struct of_phandle_args *spec)
395395
}
396396
mutex_unlock(&icc_lock);
397397

398+
if (!node)
399+
return ERR_PTR(-EINVAL);
400+
398401
if (IS_ERR(node))
399402
return ERR_CAST(node);
400403

0 commit comments

Comments
 (0)