From 3230bcfdc4b1b0e069466490af3d713444719ca4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Wed, 22 Sep 2021 15:15:46 +0200 Subject: [PATCH] MINOR: quic: Possible endless loop in qc_treat_rx_pkts() Ensure we do not endlessly treat always the same encryption level in qc_treat_rx_pkts(). --- src/xprt_quic.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/xprt_quic.c b/src/xprt_quic.c index e9055e9..98fef55 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -2643,7 +2643,9 @@ static inline int qc_treat_rx_crypto_frms(struct quic_enc_level *el, return 0; } -/* Process all the packets at encryption level. +/* Process all the packets at and encryption level. + * This is the caller responsability to check that is different of + * as pointer value. * Return 1 if succeeded, 0 if not. */ int qc_treat_rx_pkts(struct quic_enc_level *cur_el, struct quic_enc_level *next_el, @@ -2706,6 +2708,7 @@ int qc_treat_rx_pkts(struct quic_enc_level *cur_el, struct quic_enc_level *next_ goto err; if (qel == cur_el) { + BUG_ON(qel == next_el); qel = next_el; goto next_tel; } @@ -2787,9 +2790,11 @@ struct task *quic_conn_io_cb(struct task *t, void *context, unsigned int state) skip_send: /* Check if there is something to do for the next level. */ - if (next_qel && (next_qel->tls_ctx.rx.flags & QUIC_FL_TLS_SECRETS_SET) && + if (next_qel && next_qel != qel && + (next_qel->tls_ctx.rx.flags & QUIC_FL_TLS_SECRETS_SET) && (!MT_LIST_ISEMPTY(&next_qel->rx.pqpkts) || !eb_is_empty(&next_qel->rx.pkts))) { qel = next_qel; + next_qel = NULL; goto next_level; } -- 1.7.10.4