21861322 OpenSSH client hangs on broken pipe
authorTomas Kuthan <tomas.kuthan@oracle.com>
Sat, 17 Oct 2015 13:20:42 -0700
changeset 4976 0224a36cbe09
parent 4975 6445e44cfccd
child 4977 eef946d5ac8f
21861322 OpenSSH client hangs on broken pipe
components/openssh/patches/032-hang_on_closed_output.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/openssh/patches/032-hang_on_closed_output.patch	Sat Oct 17 13:20:42 2015 -0700
@@ -0,0 +1,25 @@
+#
+# Fix possible hang on closed output.
+#
+# When there is a connectivity problem between the server and the client
+# (network outage, server crash or reboot), the client indefinitely hangs.
+#
+# This patch fixes the issue by checking ssh_packet_write_poll return value
+# in ssh_packet_write_wait and passing it through.
+#
+# The (updated) patch has been accepted upstream and will be part of 7.2
+# https://github.com/openssh/openssh-portable/commit/8408218
+#
+diff -pur old/packet.c new/packet.c
+--- old/packet.c
++++ new/packet.c
[email protected]@ -2040,7 +2040,8 @@ ssh_packet_write_wait(struct ssh *ssh)
+ 	    NFDBITS), sizeof(fd_mask));
+ 	if (setp == NULL)
+ 		return SSH_ERR_ALLOC_FAIL;
+-	ssh_packet_write_poll(ssh);
++	if ((r = ssh_packet_write_poll(ssh)) != 0)
++		return r;
+ 	while (ssh_packet_have_data_to_write(ssh)) {
+ 		memset(setp, 0, howmany(state->connection_out + 1,
+ 		    NFDBITS) * sizeof(fd_mask));