crypto: gcm - wait for crypto op not signal safe
authorGilad Ben-Yossef <gilad@benyossef.com>
Thu, 18 May 2017 13:29:25 +0000 (16:29 +0300)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 15 Sep 2017 17:30:47 +0000 (18:30 +0100)
commited64640fc387a764b18e2961dc9abd5dba22e313
treed83646a111a708ba9f443c5adb17c45ae2ef7381
parent483dffa714a7f314bdf78e64b6cbd12cc8137127
crypto: gcm - wait for crypto op not signal safe

commit f3ad587070d6bd961ab942b3fd7a85d00dfc934b upstream.

crypto_gcm_setkey() was using wait_for_completion_interruptible() to
wait for completion of async crypto op but if a signal occurs it
may return before DMA ops of HW crypto provider finish, thus
corrupting the data buffer that is kfree'ed in this case.

Resolve this by using wait_for_completion() instead.

Reported-by: Eric Biggers <ebiggers3@gmail.com>
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
crypto/gcm.c