crypto: authenc - Fix sleep in atomic context in decrypt_tail
authorHerbert Xu <herbert@gondor.apana.org.au>
Wed, 19 Jan 2022 06:58:40 +0000 (17:58 +1100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 31 Jan 2022 00:21:44 +0000 (11:21 +1100)
The function crypto_authenc_decrypt_tail discards its flags
argument and always relies on the flags from the original request
when starting its sub-request.

This is clearly wrong as it may cause the SLEEPABLE flag to be
set when it shouldn't.

Fixes: 92d95ba91772 ("crypto: authenc - Convert to new AEAD interface")
Reported-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/authenc.c

index 670bf1a..17f674a 100644 (file)
@@ -253,7 +253,7 @@ static int crypto_authenc_decrypt_tail(struct aead_request *req,
                dst = scatterwalk_ffwd(areq_ctx->dst, req->dst, req->assoclen);
 
        skcipher_request_set_tfm(skreq, ctx->enc);
-       skcipher_request_set_callback(skreq, aead_request_flags(req),
+       skcipher_request_set_callback(skreq, flags,
                                      req->base.complete, req->base.data);
        skcipher_request_set_crypt(skreq, src, dst,
                                   req->cryptlen - authsize, req->iv);