From 9a0f559676c4d309edbe42ba33197e7dd8935f1c Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Mon, 15 Apr 2019 19:22:24 +0200 Subject: [PATCH] BUG/MEDIUM: h2: Make sure we're not already in the send_list in h2_subscribe(). In h2_subscribe(), don't add ourself to the send_list if we're already in it. That may happen if we try to send and fail twice, as we're only removed from the send_list if we managed to send data, to promote fairness. Failing to do so can lead to either an infinite loop, or some random crashes, as we'd get the same h2s in the send_list twice. This should be backported to 1.9. --- src/mux_h2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mux_h2.c b/src/mux_h2.c index adcd0b4df..685d58385 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -5150,7 +5150,8 @@ static int h2_subscribe(struct conn_stream *cs, int event_type, void *param) sw->events |= SUB_RETRY_SEND; sw->handle = h2s; h2s->send_wait = sw; - if (!(h2s->flags & H2_SF_BLK_SFCTL)) { + if (!(h2s->flags & H2_SF_BLK_SFCTL) && + LIST_ISEMPTY(&h2s->list)) { if (h2s->flags & H2_SF_BLK_MFCTL) LIST_ADDQ(&h2c->fctl_list, &h2s->list); else