Skip to content

Commit

Permalink
tls: decrement decrypt_pending if no async completion will be called
Browse files Browse the repository at this point in the history
[ Upstream commit f7fa16d ]

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: 94524d8 ("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>
  • Loading branch information
qsn authored and gregkh committed Mar 6, 2024
1 parent 8ceb918 commit 043b535
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/tls/tls_sw.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,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;

Expand Down

0 comments on commit 043b535

Please sign in to comment.