]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux-h2: make sure the h2c task exists before refreshing it
authorWilly Tarreau <w@1wt.eu>
Thu, 16 Mar 2023 17:06:19 +0000 (18:06 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 16 Mar 2023 17:45:46 +0000 (18:45 +0100)
When detaching a stream, if it's the last one and the mbuf is blocked,
we leave without freeing the stream yet. We also refresh the h2c task's
timeout, except that it's possible that there's no such task in case
there is no client timeout, causing a crash. The fix just consists in
doing this when the task exists.

This bug has always been there and is extremely hard to meet even
without a client timeout. This fix has to be backported to all
branches, but it's unlikely anyone has ever met it anyay.

src/mux_h2.c

index 4b426394c0880e6ccdf6c112de946ff3a5c2c10f..1edc0d22cf13301d88e2c01b7fa51dd8c3c3e560 100644 (file)
@@ -4312,7 +4312,7 @@ static void h2_detach(struct sedesc *sd)
                /* refresh the timeout if none was active, so that the last
                 * leaving stream may arm it.
                 */
-               if (!tick_isset(h2c->task->expire))
+               if (h2c->task && !tick_isset(h2c->task->expire))
                        h2c_update_timeout(h2c);
                return;
        }