linux-yocto/drivers/remoteproc
Xiaolei Wang 3ee979709e remoteproc: core: Release rproc->clean_table after rproc_attach() fails
commit bcd241230f upstream.

When rproc->state = RPROC_DETACHED is attached to remote processor
through rproc_attach(), if rproc_handle_resources() returns failure,
then the clean table should be released, otherwise the following
memory leak will occur.

unreferenced object 0xffff000086a99800 (size 1024):
comm "kworker/u12:3", pid 59, jiffies 4294893670 (age 121.140s)
hex dump (first 32 bytes):
00 00 00 00 00 80 00 00 00 00 00 00 00 00 10 00 ............
00 00 00 00 00 00 08 00 00 00 00 00 00 00 00 00 ............
backtrace:
 [<000000008bbe4ca8>] slab_post_alloc_hook+0x98/0x3fc
 [<000000003b8a272b>] __kmem_cache_alloc_node+0x13c/0x230
 [<000000007a507c51>] __kmalloc_node_track_caller+0x5c/0x260
 [<0000000037818dae>] kmemdup+0x34/0x60
 [<00000000610f7f57>] rproc_boot+0x35c/0x56c
 [<0000000065f8871a>] rproc_add+0x124/0x17c
 [<00000000497416ee>] imx_rproc_probe+0x4ec/0x5d4
 [<000000003bcaa37d>] platform_probe+0x68/0xd8
 [<00000000771577f9>] really_probe+0x110/0x27c
 [<00000000531fea59>] __driver_probe_device+0x78/0x12c
 [<0000000080036a04>] driver_probe_device+0x3c/0x118
 [<000000007e0bddcb>] __device_attach_driver+0xb8/0xf8
 [<000000000cf1fa33>] bus_for_each_drv+0x84/0xe4
 [<000000001a53b53e>] __device_attach+0xfc/0x18c
 [<00000000d1a2a32c>] device_initial_probe+0x14/0x20
 [<00000000d8f8b7ae>] bus_probe_device+0xb0/0xb4
 unreferenced object 0xffff0000864c9690 (size 16):

Fixes: 9dc9507f18 ("remoteproc: Properly deal with the resource table when detaching")
Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20250430092043.1819308-3-xiaolei.wang@windriver.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-06-27 11:08:50 +01:00
..
da8xx_remoteproc.c
imx_dsp_rproc.c
imx_rproc.c
imx_rproc.h
ingenic_rproc.c
Kconfig
keystone_remoteproc.c
Makefile
meson_mx_ao_arc.c
mtk_common.h
mtk_scp_ipi.c
mtk_scp.c
omap_remoteproc.c
omap_remoteproc.h
pru_rproc.c
pru_rproc.h
qcom_common.c
qcom_common.h
qcom_pil_info.c
qcom_pil_info.h
qcom_q6v5_adsp.c
qcom_q6v5_mss.c
qcom_q6v5_pas.c
qcom_q6v5_wcss.c
qcom_q6v5.c
qcom_q6v5.h
qcom_sysmon.c
qcom_wcnss_iris.c remoteproc: qcom_wcnss_iris: Add missing put_device() on error in probe 2025-06-19 15:28:27 +02:00
qcom_wcnss.c
qcom_wcnss.h
rcar_rproc.c
remoteproc_cdev.c
remoteproc_core.c remoteproc: core: Release rproc->clean_table after rproc_attach() fails 2025-06-27 11:08:50 +01:00
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 remoteproc: k3-r5: Drop check performed in k3_r5_rproc_{mbox_callback/kick} 2025-06-19 15:28:27 +02:00
ti_sci_proc.h
wkup_m3_rproc.c
xlnx_r5_remoteproc.c