Re: [PATCH v3 1/8] tls: Factor tls_decrypt_async_drain() from recvmsg
Alistair Francis <[email protected]> Thu, 12 Mar 2026 14:34:45 +1000
| Newsgroups | dev.linux.lists.kernel-tls-handshake,org.kernel.vger.netdev |
|---|---|
| Message-ID | <CAKmqyKPkCLUMtdu=Jk6FxE7a1AP6zRDhESvUGMGuL5tNBe7pEQ@mail.gmail.com> |
On Thu, Mar 12, 2026 at 11:48 AM Chuck Lever <[email protected]> wrote: > > From: Chuck Lever <[email protected]> > > The recvmsg path pairs tls_decrypt_async_wait() with > __skb_queue_purge(&ctx->async_hold). Bundling the two into > tls_decrypt_async_drain() gives later patches a single call for > async teardown. > > Reviewed-by: Hannes Reinecke <[email protected]> > Signed-off-by: Chuck Lever <[email protected]> Reviewed-by: Alistair Francis <[email protected]> Alistair > --- > net/tls/tls_sw.c | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c > index a656ce235758..cedcc82669db 100644 > --- a/net/tls/tls_sw.c > +++ b/net/tls/tls_sw.c > @@ -249,6 +249,18 @@ static int tls_decrypt_async_wait(struct tls_sw_context_rx *ctx) > return ctx->async_wait.err; > } > > +/* Collect all pending async AEAD completions and release the > + * skbs held for them. Returns the crypto error if any > + * operation failed, zero otherwise. > + */ > +static int tls_decrypt_async_drain(struct tls_sw_context_rx *ctx) > +{ > + int ret = tls_decrypt_async_wait(ctx); > + > + __skb_queue_purge(&ctx->async_hold); > + return ret; > +} > + > static int tls_do_decryption(struct sock *sk, > struct scatterlist *sgin, > struct scatterlist *sgout, > @@ -2223,8 +2235,7 @@ int tls_sw_recvmsg(struct sock *sk, > int ret; > > /* Wait for all previously submitted records to be decrypted */ > - ret = tls_decrypt_async_wait(ctx); > - __skb_queue_purge(&ctx->async_hold); > + ret = tls_decrypt_async_drain(ctx); > > if (ret) { > if (err >= 0 || err == -EINPROGRESS) > -- > 2.52.0 > >