rproc_alloc_firmware() (called by rproc_alloc()) can allocate rproc->firmware using kstrdup_const() and therefore should be freed using kfree_const(); however, rproc_set_firmware() frees it using the simple kfree(). This causes a kernel oops if a constant string is passed to rproc_alloc() and rproc_set_firmware() is subsequently called. Fix the above issue by using kfree_const() to free rproc->firmware in rproc_set_firmware(). Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Daniele Alessandrelli <daniele.alessandrelli@intel.com> Link: https://lore.kernel.org/r/20210118165904.719999-1-daniele.alessandrelli@linux.intel.com Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> [juhyung: A kernel panic was observed with downstream Qualcomm's qcom_spss and spss_utils modules on production phones. drivers/remoteproc/qcom_spss.c's qcom_spss_set_fw_name() have upstream's rproc_set_firmware() logic duplicated and hence needs its own fix (change to call rproc_set_firmware() directly) to fully fix the kernel panic, but remoteproc_core needs to be fixed too.] Change-Id: I7d993e38d4babc30562dd47c366cba9fda388130 (cherry picked from commit 43d3f2c715cefcfb89b10675728e9bf0d8bb98e3) Signed-off-by: Juhyung Park <qkrwngud825@gmail.com> |
||
|---|---|---|
| .. | ||
| Kconfig | ||
| Makefile | ||
| da8xx_remoteproc.c | ||
| imx_rproc.c | ||
| ingenic_rproc.c | ||
| keystone_remoteproc.c | ||
| mtk_common.h | ||
| mtk_scp.c | ||
| mtk_scp_ipi.c | ||
| omap_remoteproc.c | ||
| omap_remoteproc.h | ||
| qcom_common.c | ||
| qcom_common.h | ||
| qcom_pil_info.c | ||
| qcom_pil_info.h | ||
| qcom_q6v5.c | ||
| qcom_q6v5.h | ||
| qcom_q6v5_adsp.c | ||
| qcom_q6v5_mss.c | ||
| qcom_q6v5_pas.c | ||
| qcom_q6v5_wcss.c | ||
| qcom_sysmon.c | ||
| qcom_wcnss.c | ||
| qcom_wcnss.h | ||
| qcom_wcnss_iris.c | ||
| remoteproc_cdev.c | ||
| remoteproc_core.c | ||
| remoteproc_coredump.c | ||
| remoteproc_debugfs.c | ||
| remoteproc_elf_helpers.h | ||
| remoteproc_elf_loader.c | ||
| remoteproc_internal.h | ||
| remoteproc_sysfs.c | ||
| remoteproc_virtio.c | ||
| st_remoteproc.c | ||
| st_slim_rproc.c | ||
| stm32_rproc.c | ||
| ti_k3_dsp_remoteproc.c | ||
| ti_k3_r5_remoteproc.c | ||
| ti_sci_proc.h | ||
| wkup_m3_rproc.c | ||