]> asedeno.scripts.mit.edu Git - linux.git/commit
crypto: ccp - Fix command completion detection race
authorTom Lendacky <thomas.lendacky@amd.com>
Tue, 3 Jul 2018 17:11:33 +0000 (12:11 -0500)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 13 Jul 2018 10:26:48 +0000 (18:26 +0800)
commitf426d2b20f1cd63818873593031593e15c3db20b
tree3aab62b69acd62c556f1fe7a6a79d60fdf969b9a
parent5c324a2ffa06f8b6fda59a77c6807acb9f45cfee
crypto: ccp - Fix command completion detection race

The wait_event() function is used to detect command completion.  The
interrupt handler will set the wait condition variable when the interrupt
is triggered.  However, the variable used for wait_event() is initialized
after the command has been submitted, which can create a race condition
with the interrupt handler and result in the wait_event() never returning.
Move the initialization of the wait condition variable to just before
command submission.

Fixes: 200664d5237f ("crypto: ccp: Add Secure Encrypted Virtualization (SEV) command support")
Cc: <stable@vger.kernel.org> # 4.16.x-
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Reviewed-by: Brijesh Singh <brijesh.singh@amd.com>
Acked-by: Gary R Hook <gary.hook@amd.com>
Acked-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/ccp/psp-dev.c