crypto: atmel-sha - fix race in atmel_sha_final()
authorCyrille Pitchen <cyrille.pitchen@atmel.com>
Mon, 8 Feb 2016 15:26:49 +0000 (16:26 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 16 Feb 2016 20:07:43 +0000 (04:07 +0800)
commitad84112a1135bda928806fcbb98680847ab81436
treeb48ec319f8958b3ea67c01879bd8afb47071ba7c
parent9c4274d90d2923dda7435073de6494f0250ccb5a
crypto: atmel-sha - fix race in atmel_sha_final()

When (!ctx->bufcnt && !(ctx->flags & SHA_FLAGS_PAD)), the former source
code used to set the SHA_FLAGS_BUSY without checking whether this flag was
already set. If so, the hardware is already processing another hash
request so the processing of the req argument of atmel_sha_final() should
be delayed by queueing this request, the same way as done for the
(ctx->bufcnt != 0) case.

Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/atmel-sha.c