mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Guicai Ma <maguicai@kylinos.cn>
Cc: "David S . Miller" <davem@davemloft.net>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crypto: af_alg - wake up waiters on zero-length final message
Date: Fri, 27 Nov 2026 12:45:47 +0800	[thread overview]
Message-ID: <awkK-9grfKCPNJhY@gondor.apana.org.au> (raw)
In-Reply-To: <20261120083244.1156396-1-maguicai@kylinos.cn>

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@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2026-11-27  4:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  8:32 Guicai Ma
2026-11-27  4:45 ` Herbert Xu [this message]
2026-11-27  7:12 ` [PATCH v2] " Guicai Ma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=awkK-9grfKCPNJhY@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=davem@davemloft.net \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maguicai@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®