]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.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)
committerKhalid Elmously <khalid.elmously@canonical.com>
Sat, 8 Aug 2020 05:53:12 +0000 (01:53 -0400)
commit376699f5ecc057e5d780d7c03c02a6cefe2853c7
tree8eaa6efcc34f7f83e8ad2ec3ff0d159048099152
parent68da5df9cffda26949ab0a54a7d0d16cd64caf40
firmware: imx: warn on unexpected RX

BugLink: https://bugs.launchpad.net/bugs/1884089
[ Upstream commit cf0fd404455ce13850cc15423a3c2958933de384 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/firmware/imx/imx-scu.c