* [PATCH] crypto: sha512-mb - add some missing unlock on error
@ 2017-04-25 9:18 Dan Carpenter
2017-04-25 17:37 ` Tim Chen
2017-05-18 5:25 ` Herbert Xu
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2017-04-25 9:18 UTC (permalink / raw)
To: Herbert Xu, Tim Chen
Cc: David S. Miller, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
x86, Megha Dey, Fenghua Yu, Greg Tucker, Xiaodong Liu,
linux-crypto, kernel-janitors
We recently added some new locking but missed the unlocks on these
error paths in sha512_ctx_mgr_submit().
Fixes: c459bd7beda0 ("crypto: sha512-mb - Protect sha512 mb ctx mgr access")
Signed-off-by: Dan Carpenter <dan.carpenter@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;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: sha512-mb - add some missing unlock on error
2017-04-25 9:18 [PATCH] crypto: sha512-mb - add some missing unlock on error Dan Carpenter
@ 2017-04-25 17:37 ` Tim Chen
2017-05-18 5:25 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Tim Chen @ 2017-04-25 17:37 UTC (permalink / raw)
To: Dan Carpenter, Herbert Xu
Cc: David S. Miller, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
x86, Megha Dey, Fenghua Yu, Greg Tucker, Xiaodong Liu,
linux-crypto, kernel-janitors
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.chen@linux.intel.com>
>
> Fixes: c459bd7beda0 ("crypto: sha512-mb - Protect sha512 mb ctx mgr access")
> Signed-off-by: Dan Carpenter <dan.carpenter@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;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: sha512-mb - add some missing unlock on error
2017-04-25 9:18 [PATCH] crypto: sha512-mb - add some missing unlock on error Dan Carpenter
2017-04-25 17:37 ` Tim Chen
@ 2017-05-18 5:25 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2017-05-18 5:25 UTC (permalink / raw)
To: Dan Carpenter
Cc: Tim Chen, David S. Miller, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, x86, Megha Dey, Fenghua Yu, Greg Tucker,
Xiaodong Liu, linux-crypto, kernel-janitors
On Tue, Apr 25, 2017 at 12:18:54PM +0300, Dan Carpenter wrote:
> We recently added some new locking but missed the unlocks on these
> error paths in sha512_ctx_mgr_submit().
>
> Fixes: c459bd7beda0 ("crypto: sha512-mb - Protect sha512 mb ctx mgr access")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-18 5:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-25 9:18 [PATCH] crypto: sha512-mb - add some missing unlock on error Dan Carpenter
2017-04-25 17:37 ` Tim Chen
2017-05-18 5:25 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).