Ignore ping deadline when calculating tick deadline if we can't send
authorMatt Caswell <matt@openssl.org>
Tue, 17 Oct 2023 13:55:48 +0000 (14:55 +0100)
committerTomas Mraz <tomas@openssl.org>
Thu, 19 Oct 2023 09:54:44 +0000 (11:54 +0200)
If the CC TX allowance is zero then we cannot send a PING frame at the
moment, so do not take into account the ping deadline when calculating the
tick deadline in that case.

This avoids the hang found by the fuzzer mentioned in
https://github.com/openssl/openssl/pull/22368#issuecomment-1765131727

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22410)

ssl/quic/quic_channel.c

index a6ed14664eae7370173e24e871e9d85a242e077b..0462fd241103946f6ffa51e05cf7995943cf66fe 100644 (file)
@@ -2598,6 +2598,13 @@ static OSSL_TIME ch_determine_next_tick_deadline(QUIC_CHANNEL *ch)
                                                                     ossl_quic_enc_level_to_pn_space(i)));
             }
         }
+
+        /*
+         * When do we need to send an ACK-eliciting packet to reset the idle
+         * deadline timer for the peer?
+         */
+        if (!ossl_time_is_infinite(ch->ping_deadline))
+            deadline = ossl_time_min(deadline, ch->ping_deadline);
     }
 
     /* Apply TXP wakeup deadline. */
@@ -2612,14 +2619,6 @@ static OSSL_TIME ch_determine_next_tick_deadline(QUIC_CHANNEL *ch)
         deadline = ossl_time_min(deadline,
                                  ch->idle_deadline);
 
-    /*
-     * When do we need to send an ACK-eliciting packet to reset the idle
-     * deadline timer for the peer?
-     */
-    if (!ossl_time_is_infinite(ch->ping_deadline))
-        deadline = ossl_time_min(deadline,
-                                 ch->ping_deadline);
-
     /* When does the RXKU process complete? */
     if (ch->rxku_in_progress)
         deadline = ossl_time_min(deadline, ch->rxku_update_end_deadline);