* [PATCH] crypto: skcipher - add might_sleep() to skcipher_walk_virt()
@ 2018-12-15 20:41 Eric Biggers
2018-12-23 4:03 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Eric Biggers @ 2018-12-15 20:41 UTC (permalink / raw)
To: linux-crypto, Herbert Xu
From: Eric Biggers <ebiggers@google.com>
skcipher_walk_virt() can still sleep even with atomic=true, since that
only affects the later calls to skcipher_walk_done(). But,
skcipher_walk_virt() only has to allocate memory for some input data
layouts, so incorrectly calling it with preemption disabled can go
undetected. Use might_sleep() so that it's detected reliably.
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
crypto/skcipher.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/crypto/skcipher.c b/crypto/skcipher.c
index 17be8d9c714eb..41b4f7f27f454 100644
--- a/crypto/skcipher.c
+++ b/crypto/skcipher.c
@@ -474,6 +474,8 @@ int skcipher_walk_virt(struct skcipher_walk *walk,
{
int err;
+ might_sleep_if(req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP);
+
walk->flags &= ~SKCIPHER_WALK_PHYS;
err = skcipher_walk_skcipher(walk, req);
--
2.19.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: skcipher - add might_sleep() to skcipher_walk_virt()
2018-12-15 20:41 [PATCH] crypto: skcipher - add might_sleep() to skcipher_walk_virt() Eric Biggers
@ 2018-12-23 4:03 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2018-12-23 4:03 UTC (permalink / raw)
To: Eric Biggers; +Cc: linux-crypto
On Sat, Dec 15, 2018 at 12:41:53PM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
>
> skcipher_walk_virt() can still sleep even with atomic=true, since that
> only affects the later calls to skcipher_walk_done(). But,
> skcipher_walk_virt() only has to allocate memory for some input data
> layouts, so incorrectly calling it with preemption disabled can go
> undetected. Use might_sleep() so that it's detected reliably.
>
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
> crypto/skcipher.c | 2 ++
> 1 file changed, 2 insertions(+)
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] 2+ messages in thread
end of thread, other threads:[~2018-12-23 4:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-15 20:41 [PATCH] crypto: skcipher - add might_sleep() to skcipher_walk_virt() Eric Biggers
2018-12-23 4:03 ` 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).