crypto: ccree - unmap buffer before copying IV
authorGilad Ben-Yossef <gilad@benyossef.com>
Tue, 15 Jan 2019 13:43:15 +0000 (15:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Mar 2019 19:09:40 +0000 (20:09 +0100)
commit0bdd345a384849d6d194dd84cd60b0ccc69fd8d1
treeb5608a2fb06b7a610b27651dc155d5f369fbf592
parent009eeb9878b480cec08ade74e94e21e04cc45a24
crypto: ccree - unmap buffer before copying IV

commit c139c72e2beb3e3db5148910b3962b7322e24374 upstream.

We were copying the last ciphertext block into the IV field
for CBC before removing the DMA mapping of the output buffer
with the result of the buffer sometime being out-of-sync cache
wise and were getting intermittent cases of bad output IV.

Fix it by moving the DMA buffer unmapping before the copy.

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Fixes: 00904aa0cd59 ("crypto: ccree - fix iv handling")
Cc: <stable@vger.kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/crypto/ccree/cc_cipher.c