• Leonard Crestez's avatar
    firmware: imx: warn on unexpected RX · cf0fd404
    Leonard Crestez authored
    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: default avatarLeonard Crestez <leonard.crestez@nxp.com>
    Acked-by: default avatarAnson Huang <Anson.Huang@nxp.com>
    Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
    cf0fd404
imx-scu.c 6.59 KB