Re: [PATCH] crypto: af_alg - wake up waiters on zero-length final message
From: Herbert Xu
Date: Thu Nov 26 2026 - 23:46:02 EST
On Fri, Nov 20, 2026 at 03:32:44AM -0500, Guicai Ma wrote:
>
> diff --git a/crypto/af_alg.c b/crypto/af_alg.c
> index 7524070f26d8..9b4f8c1d2e3a 100644
> --- a/crypto/af_alg.c
> +++ b/crypto/af_alg.c
> @@ -938,7 +938,7 @@ static void af_alg_data_wakeup(struct sock *sk)
> struct af_alg_ctx *ctx = ask->private;
> struct socket_wq *wq;
>
> - if (!ctx->used)
> + if (!ctx->init || (ctx->more && !ctx->used))
Good catch. However, this is still slightly out-of-sync with the
waiting side's condition:
> ctx->init && (!ctx->more || (min && ctx->used >= min))
How about putting that whole thing into a helper and have both sides
use it to ensure that this never happens again?
Thanks,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt