remoteproc: mediatek: Check the SCP image format
authorTinghan Shen <tinghan.shen@mediatek.com>
Fri, 10 Feb 2023 03:13:54 +0000 (11:13 +0800)
committerMathieu Poirier <mathieu.poirier@linaro.org>
Sun, 12 Feb 2023 20:18:32 +0000 (13:18 -0700)
Do a sanity check on the SCP image before loading it to avoid
driver crashes.

Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20230210031354.1335-1-tinghan.shen@mediatek.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
drivers/remoteproc/mtk_scp.c

index d421a2c..0861b76 100644 (file)
@@ -649,6 +649,7 @@ static const struct rproc_ops scp_ops = {
        .load           = scp_load,
        .da_to_va       = scp_da_to_va,
        .parse_fw       = scp_parse_fw,
+       .sanity_check   = rproc_elf_sanity_check,
 };
 
 /**