summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2024-04-04 12:33:37 +0100
committerHugo Landau <hlandau@openssl.org>2024-04-19 09:33:53 +0100
commit91445871b68a1228fc2eb5eda64f281efd9ab466 (patch)
treeab91f7c7ad3cf7499fcd39784a5b5b84adace1de
parent9c123686d6339842886f877b230f3d06ad9c4226 (diff)
QUIC APL: Ensure incoming stream data can be drained after connection closure
Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/24037)
-rw-r--r--ssl/quic/quic_impl.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ssl/quic/quic_impl.c b/ssl/quic/quic_impl.c
index 6725f282c2..51e419385b 100644
--- a/ssl/quic/quic_impl.c
+++ b/ssl/quic/quic_impl.c
@@ -2907,11 +2907,6 @@ static int quic_read(SSL *s, void *buf, size_t len, size_t *bytes_read, int peek
qctx_lock_for_io(&ctx);
- if (!quic_mutation_allowed(ctx.qc, /*req_active=*/0)) {
- ret = QUIC_RAISE_NON_NORMAL_ERROR(&ctx, SSL_R_PROTOCOL_IS_SHUTDOWN, NULL);
- goto out;
- }
-
/* If we haven't finished the handshake, try to advance it. */
if (quic_do_handshake(&ctx) < 1) {
ret = 0; /* ossl_quic_do_handshake raised error here */
@@ -2943,8 +2938,13 @@ static int quic_read(SSL *s, void *buf, size_t len, size_t *bytes_read, int peek
* Even though we succeeded, tick the reactor here to ensure we are
* handling other aspects of the QUIC connection.
*/
- qctx_maybe_autotick(&ctx);
+ if (quic_mutation_allowed(ctx.qc, /*req_active=*/0))
+ qctx_maybe_autotick(&ctx);
+
ret = 1;
+ } else if (!quic_mutation_allowed(ctx.qc, /*req_active=*/0)) {
+ ret = QUIC_RAISE_NON_NORMAL_ERROR(&ctx, SSL_R_PROTOCOL_IS_SHUTDOWN, NULL);
+ goto out;
} else if (qctx_blocking(&ctx)) {
/*
* We were not able to read anything immediately, so our stream