]> git.hungrycats.org Git - linux/commitdiff
tls: decrement decrypt_pending if no async completion will be called
authorSabrina Dubroca <sd@queasysnail.net>
Wed, 28 Feb 2024 22:43:57 +0000 (23:43 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Mar 2024 14:38:47 +0000 (14:38 +0000)
[ Upstream commit f7fa16d49837f947ee59492958f9e6f0e51d9a78 ]

With mixed sync/async decryption, or failures of crypto_aead_decrypt,
we increment decrypt_pending but we never do the corresponding
decrement since tls_decrypt_done will not be called. In this case, we
should decrement decrypt_pending immediately to avoid getting stuck.

For example, the prequeue prequeue test gets stuck with mixed
modes (one async decrypt + one sync decrypt).

Fixes: 94524d8fc965 ("net/tls: Add support for async decryption of tls records")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Link: https://lore.kernel.org/r/c56d5fc35543891d5319f834f25622360e1bfbec.1709132643.git.sd@queasysnail.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/tls/tls_sw.c

index a1a99f9f093b13881f1e4a980ecb245b4f73b67a..83319a3b8bdd17cf040c32b886b3ede6b14cdb59 100644 (file)
@@ -273,6 +273,8 @@ static int tls_do_decryption(struct sock *sk,
                        return 0;
 
                ret = crypto_wait_req(ret, &ctx->async_wait);
+       } else if (darg->async) {
+               atomic_dec(&ctx->decrypt_pending);
        }
        darg->async = false;