Skip to content

Commit e481240

Browse files
committed
BUG/MEDIUM: stream: Prevent mux upgrades if client connection is no longer ready
If an early error occurred on the client connection, we must prevent any multiplexer upgrades. Indeed, it is unexpected for a mux to be initialized with no xprt. On a normal workflow it is impossible. So it is not an issue. But if a mux upgrade is performed at the stream level, an early error on the connection may have already been handled by the previous mux and the connection may be already fully closed. If the mux upgrade is still performed, a crash can be experienced. It is possible to have a crash with an implicit TCP>HTTP upgrade if there is no data in the input buffer. But it is also possible to get a crash with an explicit "switch-mode http" rule. It must be backported to all stable versions. In 2.2, the patch must be applied directly in stream_set_backend() function.
1 parent 4ef5251 commit e481240

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/stream.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,6 +1489,10 @@ int stream_set_http_mode(struct stream *s, const struct mux_proto_list *mux_prot
14891489
return 0;
14901490

14911491
conn = sc_conn(sc);
1492+
1493+
if (!sc_conn_ready(sc))
1494+
return 0;
1495+
14921496
if (conn) {
14931497
se_have_more_data(s->scf->sedesc);
14941498
/* Make sure we're unsubscribed, the the new

0 commit comments

Comments
 (0)