lkml.org 
[lkml]   [2019]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: crypto: xts - Fix atomic sleep when walking skcipher
On Sun, Apr 14, 2019 at 09:35:13AM -0700, Eric Biggers wrote:
>
> This isn't correct because skcipher_walk_virt() can still sleep when
> atomic=true, since it may need to copy the IV. That's why I added might_sleep()
> to it in commit bb648291fc04, and that's what's triggering here.

Thanks for catching this Eric!

> This is the correct fix:
>
> diff --git a/crypto/xts.c b/crypto/xts.c
> index aed11e63ca315..359ef15e1673e 100644
> --- a/crypto/xts.c
> +++ b/crypto/xts.c
> @@ -101,6 +101,7 @@ static int xor_tweak(struct skcipher_request *req, bool second_pass)
> req = &rctx->subreq;
> /* set to our TFM to enforce correct alignment: */
> skcipher_request_set_tfm(req, tfm);
> + req->base.flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
> }

This is what I'm doing in v2, except I've moved it over to
crypt_done so that we don't affect the synchronous path.

Cheers,
--
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

\
 
 \ /
  Last update: 2019-04-15 08:39    [W:0.058 / U:0.540 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site