Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: krb5enc - fix sleepable flag handling in encrypt dispatch

krb5enc_encrypt_ahash_done() continues encryption from an ahash
completion callback by calling krb5enc_dispatch_encrypt().

That helper takes a flags argument for this continuation path, but it
ignored that argument and reused aead_request_flags(req) when setting
up the skcipher subrequest callback. This can incorrectly preserve
CRYPTO_TFM_REQ_MAY_SLEEP when the encrypt step is started from callback
context.

Preserve the original request flags but clear
CRYPTO_TFM_REQ_MAY_SLEEP for the callback continuation path, and use
the caller-supplied flags when setting up the skcipher subrequest.

Fixes: d1775a177f7f ("crypto: Add 'krb5enc' hash and cipher AEAD algorithm")
Assisted-by: Codex:GPT-5
Signed-off-by: Wesley Atwell <atwellwea@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Wesley Atwell and committed by
Herbert Xu
2ef3bac1 e0ce97f7

+3 -2
+3 -2
crypto/krb5enc.c
··· 154 154 dst = scatterwalk_ffwd(areq_ctx->dst, req->dst, req->assoclen); 155 155 156 156 skcipher_request_set_tfm(skreq, enc); 157 - skcipher_request_set_callback(skreq, aead_request_flags(req), 157 + skcipher_request_set_callback(skreq, flags, 158 158 krb5enc_encrypt_done, req); 159 159 skcipher_request_set_crypt(skreq, src, dst, req->cryptlen, req->iv); 160 160 ··· 192 192 193 193 krb5enc_insert_checksum(req, ahreq->result); 194 194 195 - err = krb5enc_dispatch_encrypt(req, 0); 195 + err = krb5enc_dispatch_encrypt(req, 196 + aead_request_flags(req) & ~CRYPTO_TFM_REQ_MAY_SLEEP); 196 197 if (err != -EINPROGRESS) 197 198 aead_request_complete(req, err); 198 199 }