Commit 15a9b363 authored by Dan Carpenter's avatar Dan Carpenter Committed by Herbert Xu

crypto: sha512-mb - add some missing unlock on error

We recently added some new locking but missed the unlocks on these
error paths in sha512_ctx_mgr_submit().

Fixes: c459bd7b ("crypto: sha512-mb - Protect sha512 mb ctx mgr access")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarTim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 981a2e3e
...@@ -269,19 +269,19 @@ static struct sha512_hash_ctx ...@@ -269,19 +269,19 @@ static struct sha512_hash_ctx
* LAST * LAST
*/ */
ctx->error = HASH_CTX_ERROR_INVALID_FLAGS; ctx->error = HASH_CTX_ERROR_INVALID_FLAGS;
return ctx; goto unlock;
} }
if (ctx->status & HASH_CTX_STS_PROCESSING) { if (ctx->status & HASH_CTX_STS_PROCESSING) {
/* Cannot submit to a currently processing job. */ /* Cannot submit to a currently processing job. */
ctx->error = HASH_CTX_ERROR_ALREADY_PROCESSING; ctx->error = HASH_CTX_ERROR_ALREADY_PROCESSING;
return ctx; goto unlock;
} }
if ((ctx->status & HASH_CTX_STS_COMPLETE) && !(flags & HASH_FIRST)) { if ((ctx->status & HASH_CTX_STS_COMPLETE) && !(flags & HASH_FIRST)) {
/* Cannot update a finished job. */ /* Cannot update a finished job. */
ctx->error = HASH_CTX_ERROR_ALREADY_COMPLETED; ctx->error = HASH_CTX_ERROR_ALREADY_COMPLETED;
return ctx; goto unlock;
} }
...@@ -363,6 +363,7 @@ static struct sha512_hash_ctx ...@@ -363,6 +363,7 @@ static struct sha512_hash_ctx
} }
ctx = sha512_ctx_mgr_resubmit(mgr, ctx); ctx = sha512_ctx_mgr_resubmit(mgr, ctx);
unlock:
spin_unlock_irqrestore(&cstate->work_lock, irqflags); spin_unlock_irqrestore(&cstate->work_lock, irqflags);
return ctx; return ctx;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment