]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
firmware: imx: warn on unexpected RX
authorLeonard Crestez <leonard.crestez@nxp.com>
Wed, 4 Sep 2019 07:54:58 +0000 (10:54 +0300)
committerShawn Guo <shawnguo@kernel.org>
Sun, 6 Oct 2019 00:58:59 +0000 (08:58 +0800)
commitcf0fd404455ce13850cc15423a3c2958933de384
treea24e4e0c6c02b4568700dc787336f8c890a37caa
parent54ecb8f7028c5eb3d740bb82b0f1d90f2df63c5c
firmware: imx: warn on unexpected RX

The imx_scu_call_rpc function returns the result inside the
same "msg" struct containing the transmitted message. This is
implemented by holding a pointer to msg (which is usually on the stack)
in sc_imx_rpc and writing to it from imx_scu_rx_callback.

This means that if the have_resp parameter is incorrect or SCU sends an
unexpected response for any reason the most likely result is kernel stack
corruption.

Fix this by only setting sc_imx_rpc.msg for the duration of the
imx_scu_call_rpc call and warning in imx_scu_rx_callback if unset.

Print the unexpected response data to help debugging.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Acked-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
drivers/firmware/imx/imx-scu.c