Skip to content

Commit cbdad1f

Browse files
committed
crypto: algif_aead - Do not set MAY_BACKLOG on the async path
The async path cannot use MAY_BACKLOG because it is not meant to block, which is what MAY_BACKLOG does. On the other hand, both the sync and async paths can make use of MAY_SLEEP. Fixes: 83094e5 ("crypto: af_alg - add async support to...") Cc: <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 2a05b02 commit cbdad1f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

crypto/algif_aead.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static int crypto_aead_copy_sgl(struct crypto_sync_skcipher *null_tfm,
7878
SYNC_SKCIPHER_REQUEST_ON_STACK(skreq, null_tfm);
7979

8080
skcipher_request_set_sync_tfm(skreq, null_tfm);
81-
skcipher_request_set_callback(skreq, CRYPTO_TFM_REQ_MAY_BACKLOG,
81+
skcipher_request_set_callback(skreq, CRYPTO_TFM_REQ_MAY_SLEEP,
8282
NULL, NULL);
8383
skcipher_request_set_crypt(skreq, src, dst, len, NULL);
8484

@@ -291,19 +291,20 @@ static int _aead_recvmsg(struct socket *sock, struct msghdr *msg,
291291
areq->outlen = outlen;
292292

293293
aead_request_set_callback(&areq->cra_u.aead_req,
294-
CRYPTO_TFM_REQ_MAY_BACKLOG,
294+
CRYPTO_TFM_REQ_MAY_SLEEP,
295295
af_alg_async_cb, areq);
296296
err = ctx->enc ? crypto_aead_encrypt(&areq->cra_u.aead_req) :
297297
crypto_aead_decrypt(&areq->cra_u.aead_req);
298298

299299
/* AIO operation in progress */
300-
if (err == -EINPROGRESS || err == -EBUSY)
300+
if (err == -EINPROGRESS)
301301
return -EIOCBQUEUED;
302302

303303
sock_put(sk);
304304
} else {
305305
/* Synchronous operation */
306306
aead_request_set_callback(&areq->cra_u.aead_req,
307+
CRYPTO_TFM_REQ_MAY_SLEEP |
307308
CRYPTO_TFM_REQ_MAY_BACKLOG,
308309
crypto_req_done, &ctx->wait);
309310
err = crypto_wait_req(ctx->enc ?

0 commit comments

Comments
 (0)