]> git.baikalelectronics.ru Git - kernel.git/commit
firmware: arm_scmi: Fix base agent discover response
authorVincent Guittot <vincent.guittot@linaro.org>
Wed, 17 Nov 2021 08:18:56 +0000 (09:18 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Dec 2021 08:04:46 +0000 (09:04 +0100)
commit2bdbd8634bb479f63e73e58c70cde4d3f1b67406
treedb015f6f5787037892653cb8c5efd604ef729b6a
parent74db146ae9611ec6d763a6d73e00612ba73893f9
firmware: arm_scmi: Fix base agent discover response

[ Upstream commit 9de593ba57cce13f714d1cca2d01dd04cb9a1ffd ]

According to scmi specification, the response of the discover agent request
is made of:
- int32 status
- uint32 agent_id
- uint8 name[16]

but the current implementation doesn't take into account the agent_id field
and only allocates a rx buffer of SCMI_MAX_STR_SIZE length

Allocate the correct length for rx buffer and copy the name from the
correct offset in the response.

While no error were returned until v5.15, v5.16-rc1 fails with virtio_scmi
transport channel:

 | arm-scmi firmware:scmi0: SCMI Notifications - Core Enabled.
 | arm-scmi firmware:scmi0: SCMI Protocol v2.0 'Linaro:PMWG' Firmware version 0x2090000
 | scmi-virtio virtio0: tx:used len 28 is larger than in buflen 24

Link: https://lore.kernel.org/r/20211117081856.9932-1-vincent.guittot@linaro.org
Fixes: 2f6e27266acb ("firmware: arm_scmi: add common infrastructure and support for base protocol")
Tested-by: Cristian Marussi <cristian.marussi@arm.com>
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/firmware/arm_scmi/base.c