]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: stconn: Don't report abort from SC if read0 was already received
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 11 Dec 2025 16:11:36 +0000 (17:11 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 12 Dec 2025 07:41:08 +0000 (08:41 +0100)
SC_FL_ABRT_DONE flag should never be set when SC_FL_EOS was already
set. These both flags were introduced to replace the old CF_SHUTR and to
have a flag for shuts driven by the stream and a flag for the read0 received
by the mux. So both flags must not be seen at same time on a SC. It is
espeically important because some processing are performed when these flags
are set. And wrong decisions may be made.

This patch must be backproted as far as 2.8.

src/stconn.c

index f3b030fd6878f55a0b6f31e310c9861d3263e625..1f2294fa2092c92af59413e2844a8581499aff7f 100644 (file)
@@ -694,7 +694,8 @@ static void sc_app_shut(struct stconn *sc)
        }
 
        sc->flags &= ~SC_FL_NOLINGER;
-       sc->flags |= SC_FL_ABRT_DONE;
+       if (!(sc->flags & (SC_FL_EOS|SC_FL_ABRT_DONE)))
+               sc->flags |= SC_FL_ABRT_DONE;
        if (sc->flags & SC_FL_ISBACK)
                __sc_strm(sc)->conn_exp = TICK_ETERNITY;
 
@@ -830,7 +831,8 @@ static void sc_app_shut_conn(struct stconn *sc)
        }
 
        sc->flags &= ~SC_FL_NOLINGER;
-       sc->flags |= SC_FL_ABRT_DONE;
+       if (!(sc->flags & (SC_FL_EOS|SC_FL_ABRT_DONE)))
+               sc->flags |= SC_FL_ABRT_DONE;
        if (sc->flags & SC_FL_ISBACK)
                __sc_strm(sc)->conn_exp = TICK_ETERNITY;
 }
@@ -1014,7 +1016,8 @@ static void sc_app_shut_applet(struct stconn *sc)
        }
 
        sc->flags &= ~SC_FL_NOLINGER;
-       sc->flags |= SC_FL_ABRT_DONE;
+       if (!(sc->flags & (SC_FL_EOS|SC_FL_ABRT_DONE)))
+               sc->flags |= SC_FL_ABRT_DONE;
        if (sc->flags & SC_FL_ISBACK)
                __sc_strm(sc)->conn_exp = TICK_ETERNITY;
 }