Skip to content
Commit 9054a31d authored by Mans Rullgard's avatar Mans Rullgard Committed by Stephen Boyd
Browse files

clk: check for invalid parent index of orphans in __clk_init()



If a mux clock is initialised (by hardware or firmware) with an
invalid parent, its ->get_parent() can return an out of range
index.  For example, the generic mux clock attempts to return
-EINVAL, which due to the u8 return type ends up a rather large
number.  Using this index with the parent_names[] array results
in an invalid pointer and (usually) a crash in the following
strcmp().

This patch adds a check for the parent index being in range,
ignoring clocks reporting invalid values.

Signed-off-by: default avatarMans Rullgard <mans@mansr.com>
Tested-by: default avatarRhyland Klein <rklein@nvidia.com>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
parent e1595d89
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment