From: Chuck Lever 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 Signed-off-by: Chuck Lever --- 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