Skip to content

Commit 03729cf

Browse files
dgerlachtmlind
authored andcommitted
soc: ti: wkup_m3_ipc: Fix race condition with rproc_boot
Any user of wkup_m3_ipc calls wkup_m3_ipc_get to get a handle and this checks the value of the static variable m3_ipc_state to see if the wkup_m3 is ready. Currently this is populated during probe before rproc_boot has been called, meaning there is a window of time that wkup_m3_ipc_get can return a valid handle but the wkup_m3 itself is not ready, leading to invalid IPC calls to the wkup_m3 and system instability. To avoid this, move the population of the m3_ipc_state variable until after rproc_boot has succeeded to guarantee a valid and usable handle is always returned. Reported-by: Suman Anna <[email protected]> Signed-off-by: Dave Gerlach <[email protected]> Acked-by: Santosh Shilimkar <[email protected]> Signed-off-by: Tony Lindgren <[email protected]>
1 parent e17e7c4 commit 03729cf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/soc/ti/wkup_m3_ipc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,8 @@ static void wkup_m3_rproc_boot_thread(struct wkup_m3_ipc *m3_ipc)
419419
ret = rproc_boot(m3_ipc->rproc);
420420
if (ret)
421421
dev_err(dev, "rproc_boot failed\n");
422+
else
423+
m3_ipc_state = m3_ipc;
422424

423425
do_exit(0);
424426
}
@@ -505,8 +507,6 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev)
505507
goto err_put_rproc;
506508
}
507509

508-
m3_ipc_state = m3_ipc;
509-
510510
return 0;
511511

512512
err_put_rproc:

0 commit comments

Comments
 (0)