]> www.infradead.org Git - users/dwmw2/linux.git/commit
firmware: arm_scmi: Check if platform has released shmem before using
authorSudeep Holla <sudeep.holla@arm.com>
Mon, 8 Jul 2019 14:48:36 +0000 (15:48 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Oct 2019 11:13:37 +0000 (13:13 +0200)
commitfc31f1c241b0e8fad6df8417b4d3c94c6b3651f2
tree9b2757c1c229ca8166e6001957485ad57837fadf
parenta1a19299a6a5d229a7ea28648930b1c56eb007c5
firmware: arm_scmi: Check if platform has released shmem before using

[ Upstream commit 9dc34d635c67e57051853855c43249408641a5ab ]

Sometimes platfom may take too long to respond to the command and OS
might timeout before platform transfer the ownership of the shared
memory region to the OS with the response.

Since the mailbox channel associated with the channel is freed and new
commands are dispatch on the same channel, OS needs to wait until it
gets back the ownership. If not, either OS may end up overwriting the
platform response for the last command(which is fine as OS timed out
that command) or platform might overwrite the payload for the next
command with the response for the old.

The latter is problematic as platform may end up interpretting the
response as the payload. In order to avoid such race, let's wait until
the OS gets back the ownership before we prepare the shared memory with
the payload for the next command.

Reported-by: Jim Quinlan <james.quinlan@broadcom.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/firmware/arm_scmi/driver.c