crypto: cavium - Limit result reading attempts
authorJan Glauber <jglauber@cavium.com>
Mon, 9 Apr 2018 15:45:51 +0000 (17:45 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 16 Jun 2018 07:45:18 +0000 (09:45 +0200)
commitb9705796e44b4af5b4cbfd299d4c52e4318ff52c
tree29ebc99773a052cc4b635257b7f6ebef83c11e74
parent072e8b1f58d5e4cfdd80dfb36fce06628f9f4068
crypto: cavium - Limit result reading attempts

commit c782a8c43e94ba6c09e9de2d69b5e3a5840ce61c upstream.

After issuing a request an endless loop was used to read the
completion state from memory which is asynchronously updated
by the ZIP coprocessor.

Add an upper bound to the retry attempts to prevent a CPU getting stuck
forever in case of an error. Additionally, add a read memory barrier
and a small delay between the reading attempts.

Signed-off-by: Jan Glauber <jglauber@cavium.com>
Reviewed-by: Robert Richter <rrichter@cavium.com>
Cc: stable <stable@vger.kernel.org> # 4.14
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/crypto/cavium/zip/common.h
drivers/crypto/cavium/zip/zip_deflate.c
drivers/crypto/cavium/zip/zip_inflate.c