From e1cae428791abf4e4fdf3969761eaaafd45df636 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Tue, 3 Sep 2024 15:19:51 +0200 Subject: [PATCH] BUG/MEDIUM: mux-pt: Fix condition to perform a shutdown for writes in mux_pt_shut() A regression was introduced in the commit 76fa71f7a ("BUG/MEDIUM: mux-pt: Never fully close the connection on shutdown") because of a typo on the connection flags. CO_FL_SOCK_WR_SH flag must be tested to prevent a call to conn_sock_shutw() and not CO_FL_SOCK_RD_SH. Concretly, most of time, it is harmeless because shutdown for writes is always performed before any shutdown for reads. Except in case describe by the commit above. But it is not clear if it has an impact or not. This patch must be backported with the commit above, so as far as 2.9. --- src/mux_pt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mux_pt.c b/src/mux_pt.c index 9e9f1157f6..277e16d80a 100644 --- a/src/mux_pt.c +++ b/src/mux_pt.c @@ -470,7 +470,7 @@ static void mux_pt_shut(struct stconn *sc, unsigned int mode, struct se_abort_in if (mode & (SE_SHW_SILENT|SE_SHW_NORMAL)) { if (conn_xprt_ready(conn) && conn->xprt->shutw) conn->xprt->shutw(conn, conn->xprt_ctx, (mode & SE_SHW_NORMAL)); - if (!(conn->flags & CO_FL_SOCK_RD_SH)) + if (!(conn->flags & CO_FL_SOCK_WR_SH)) conn_sock_shutw(conn, (mode & SE_SHW_NORMAL)); }