Skip to content

Commit e9076ff

Browse files
cris-masudeep-holla
authored andcommitted
firmware: arm_scmi: Harden accesses to the reset domains
Accessing reset domains descriptors by the index upon the SCMI drivers requests through the SCMI reset operations interface can potentially lead to out-of-bound violations if the SCMI driver misbehave. Add an internal consistency check before any such domains descriptors accesses. Link: https://lore.kernel.org/r/20220817172731.1185305-5-cristian.marussi@arm.com Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
1 parent 76f89c9 commit e9076ff

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/firmware/arm_scmi/reset.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,12 @@ static int scmi_domain_reset(const struct scmi_protocol_handle *ph, u32 domain,
166166
struct scmi_xfer *t;
167167
struct scmi_msg_reset_domain_reset *dom;
168168
struct scmi_reset_info *pi = ph->get_priv(ph);
169-
struct reset_dom_info *rdom = pi->dom_info + domain;
169+
struct reset_dom_info *rdom;
170170

171+
if (domain >= pi->num_domains)
172+
return -EINVAL;
173+
174+
rdom = pi->dom_info + domain;
171175
if (rdom->async_reset)
172176
flags |= ASYNCHRONOUS_RESET;
173177

0 commit comments

Comments
 (0)