firmware: arm_scmi: Validate BASE_DISCOVER_LIST_PROTOCOLS response
authorCristian Marussi <cristian.marussi@arm.com>
Wed, 30 Mar 2022 15:05:33 +0000 (16:05 +0100)
committerSudeep Holla <sudeep.holla@arm.com>
Thu, 28 Apr 2022 17:22:50 +0000 (18:22 +0100)
commit3b0041f6e10e5bdbb646d98172be43e88734ed62
treef1ed3e5b8bb6ed2a17256c858387d6996b20b413
parent8009120e0354a67068e920eb10dce532391361d0
firmware: arm_scmi: Validate BASE_DISCOVER_LIST_PROTOCOLS response

Do not blindly trust SCMI platform response about list of implemented
protocols, instead validate the reported length of the list of protocols
against the real payload size of the message reply.

Link: https://lore.kernel.org/r/20220330150551.2573938-5-cristian.marussi@arm.com
Fixes: b6f20ff8bd94 ("firmware: arm_scmi: add common infrastructure and support for base protocol")
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
[sudeep.holla: Added early break if loop_num_ret = 0 and simplified calc_list_sz
calculation]
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/firmware/arm_scmi/base.c