On Tue, 2017-04-25 at 12:18 +0300, Dan Carpenter wrote:
> We recently added some new locking but missed the unlocks on these
> error paths in sha512_ctx_mgr_submit().

Thanks for catching this issue.

Acked-by: Tim Chen <tim.c.c...@linux.intel.com>

> 
> Fixes: c459bd7beda0 ("crypto: sha512-mb - Protect sha512 mb ctx mgr access")
> Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com>
> 
> diff --git a/arch/x86/crypto/sha512-mb/sha512_mb.c 
> b/arch/x86/crypto/sha512-mb/sha512_mb.c
> index 2dd3674b5a1e..458409b7568d 100644
> --- a/arch/x86/crypto/sha512-mb/sha512_mb.c
> +++ b/arch/x86/crypto/sha512-mb/sha512_mb.c
> @@ -269,19 +269,19 @@ static struct sha512_hash_ctx
>                * LAST
>                */
>               ctx->error = HASH_CTX_ERROR_INVALID_FLAGS;
> -             return ctx;
> +             goto unlock;
>       }
>  
>       if (ctx->status & HASH_CTX_STS_PROCESSING) {
>               /* Cannot submit to a currently processing job. */
>               ctx->error = HASH_CTX_ERROR_ALREADY_PROCESSING;
> -             return ctx;
> +             goto unlock;
>       }
>  
>       if ((ctx->status & HASH_CTX_STS_COMPLETE) && !(flags & HASH_FIRST)) {
>               /* Cannot update a finished job. */
>               ctx->error = HASH_CTX_ERROR_ALREADY_COMPLETED;
> -             return ctx;
> +             goto unlock;
>       }
>  
>  
> @@ -363,6 +363,7 @@ static struct sha512_hash_ctx
>       }
>  
>       ctx = sha512_ctx_mgr_resubmit(mgr, ctx);
> +unlock:
>       spin_unlock_irqrestore(&cstate->work_lock, irqflags);
>       return ctx;
>  }

Reply via email to