From 7d7df1cf0a9fad64098654e34984838525fadeec Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Tue, 7 Nov 2023 18:16:33 +0100 Subject: [PATCH] BUG/MEDIUM: mux-h1: Be sure xprt support splicing to use it during fast-forward The commit d6d4abdc3 ("BUILD: mux-h1: Fix build without kernel splicing support") introduced a regression. The kernel support for the underlying XPRT is no longer checked. So it is possible to enable the splicing for SSL connection. This of course leads to a segfault. This patch restore the test on the xprt rcv_pipe/snd_pipe functions. This patch should fix a crash reported by Tristan in #2095 (#issuecomment-1788949014). No backport needed. --- src/mux_h1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mux_h1.c b/src/mux_h1.c index 4477c5a1661bf..6be547088bbbc 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -4424,7 +4424,7 @@ static size_t h1_nego_ff(struct stconn *sc, struct buffer *input, size_t count, */ if (!b_data(input) && !b_data(&h1c->obuf) && may_splice) { #if defined(USE_LINUX_SPLICE) - if (h1s->sd->iobuf.pipe || (pipes_used < global.maxpipes && (h1s->sd->iobuf.pipe = get_pipe()))) { + if (h1c->conn->xprt->snd_pipe && (h1s->sd->iobuf.pipe || (pipes_used < global.maxpipes && (h1s->sd->iobuf.pipe = get_pipe())))) { h1s->sd->iobuf.offset = 0; h1s->sd->iobuf.data = 0; ret = count; @@ -4585,7 +4585,7 @@ static int h1_fastfwd(struct stconn *sc, unsigned int count, unsigned int flags) if (h1m->state == H1_MSG_DATA && (h1m->flags & (H1_MF_CHNK|H1_MF_CLEN)) && count > h1m->curr_len) count = h1m->curr_len; - try = se_nego_ff(sdo, &h1c->ibuf, count, !!(flags & CO_RFL_MAY_SPLICE) && !(sdo->iobuf.flags & IOBUF_FL_NO_SPLICING)); + try = se_nego_ff(sdo, &h1c->ibuf, count, h1c->conn->xprt->rcv_pipe && !!(flags & CO_RFL_MAY_SPLICE) && !(sdo->iobuf.flags & IOBUF_FL_NO_SPLICING)); if (b_room(&h1c->ibuf) && (h1c->flags & H1C_F_IN_FULL)) { h1c->flags &= ~H1C_F_IN_FULL; TRACE_STATE("h1c ibuf not full anymore", H1_EV_STRM_RECV|H1_EV_H1C_BLK);