Ensure crash_handler work is cancelled before tearing down rproc resources
to avoid accessing freed memory.

Signed-off-by: Jingyi Wang <[email protected]>
---
 drivers/remoteproc/remoteproc_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/remoteproc/remoteproc_core.c 
b/drivers/remoteproc/remoteproc_core.c
index 6e23cb11e515..abaa3786731b 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -2327,6 +2327,7 @@ int rproc_add(struct rproc *rproc)
        return 0;
 
 rproc_remove_dev:
+       cancel_work_sync(&rproc->crash_handler);
        rproc_delete_debug_dir(rproc);
        device_del(dev);
 rproc_remove_cdev:

-- 
2.34.1


Reply via email to