[openssh-commits] [openssh] 73/87: upstream: more completely close mux fds when the owning process

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Oct 30 20:21:50 AEDT 2026


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit 170dfa9cdd3bf5f5ea433d5844ea976e6ec717dd
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Fri Oct 30 08:27:49 2026 +0000

    upstream: more completely close mux fds when the owning process
    
    goes away. Avoid case where the server could still write stderr data while in
    the DRAIN state if it never sent a CLOSE
    
    Anthropic ANT-2026-T8GUCMJY
    
    OpenBSD-Commit-ID: 061eaf51dee48212651ffaa9df46f915bc6494d1
---
 mux.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/mux.c b/mux.c
index 23376c861..5b34dba2b 100644
--- a/mux.c
+++ b/mux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mux.c,v 1.117 2026/10/30 07:25:33 djm Exp $ */
+/* $OpenBSD: mux.c,v 1.118 2026/10/30 08:27:49 djm Exp $ */
 /*
  * Copyright (c) 2002-2008 Damien Miller <djm at openbsd.org>
  *
@@ -222,8 +222,16 @@ mux_master_control_cleanup_cb(struct ssh *ssh, int cid, int force, void *unused)
 		} else {
 			if (sc->istate == CHAN_INPUT_OPEN)
 				chan_read_failed(ssh, sc);
-			if (sc->ostate == CHAN_OUTPUT_OPEN)
+			if (sc->ostate == CHAN_OUTPUT_OPEN ||
+			    sc->ostate == CHAN_OUTPUT_WAIT_DRAIN)
 				chan_write_failed(ssh, sc);
+			/*
+			 * Also close the client's stderr, otherwise the
+			 * server could keep writing extended data to it
+			 * until the channel is fully closed.
+			 */
+			if (sc->efd != -1)
+				channel_close_fd(ssh, sc, &sc->efd);
 		}
 	}
 	channel_cancel_cleanup(ssh, c->self);

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list