]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
soc: ti: wkup_m3_ipc: Fix race condition with rproc_boot
authorDave Gerlach <d-gerlach@ti.com>
Thu, 12 Dec 2019 04:03:14 +0000 (22:03 -0600)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 6 Mar 2020 07:13:20 +0000 (02:13 -0500)
commit56c10cba27adf198c8426978e462539761b9a200
tree291e4f1a8e821405bd8afad20cc0b60a4c880f6d
parentccbb01ac279d1217fe5d8928257e3e7ee234180b
soc: ti: wkup_m3_ipc: Fix race condition with rproc_boot

BugLink: https://bugs.launchpad.net/bugs/1864904
[ Upstream commit 03729cfa0d543bc996bf959e762ec999afc8f3d2 ]

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 <s-anna@ti.com>
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Acked-by: Santosh Shilimkar <ssantosh@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/soc/ti/wkup_m3_ipc.c