blob: 39f14453b8d34578dc880f4653258bedd580b238 [file] [log] [blame]
From 72fc0281f9b8291a1b33fdba49e2cec4e42de9d5 Mon Sep 17 00:00:00 2001
From: Dave Gerlach <>
Date: Wed, 11 Dec 2019 22:03:14 -0600
Subject: [PATCH] soc: ti: wkup_m3_ipc: Fix race condition with rproc_boot
commit 03729cfa0d543bc996bf959e762ec999afc8f3d2 upstream.
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
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 <>
Signed-off-by: Dave Gerlach <>
Acked-by: Santosh Shilimkar <>
Signed-off-by: Tony Lindgren <>
Signed-off-by: Paul Gortmaker <>
diff --git a/drivers/soc/ti/wkup_m3_ipc.c b/drivers/soc/ti/wkup_m3_ipc.c
index 378369d9364a..e9ece45d7a33 100644
--- a/drivers/soc/ti/wkup_m3_ipc.c
+++ b/drivers/soc/ti/wkup_m3_ipc.c
@@ -419,6 +419,8 @@ static void wkup_m3_rproc_boot_thread(struct wkup_m3_ipc *m3_ipc)
ret = rproc_boot(m3_ipc->rproc);
if (ret)
dev_err(dev, "rproc_boot failed\n");
+ else
+ m3_ipc_state = m3_ipc;
@@ -505,8 +507,6 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev)
goto err_put_rproc;
- m3_ipc_state = m3_ipc;
return 0;