summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2022-04-11 22:52:09 +0000
committerDamien Miller <djm@cvs.openbsd.org>2022-04-11 22:52:09 +0000
commita4122dc8e95d5607aae9f8df77b0f68b13d9b206 (patch)
tree049f0d0358e453324ed6bc5f919f6539db68d362 /usr.bin
parentee8701a1d5c59319dae8a642536c167037599b43 (diff)
clear io_want/io_ready flags at start of poll() cycle;
avoids plausible spin during rekeying if channel io_want flags are reused across cycles. ok markus@ deraadt@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/channels.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/ssh/channels.c b/usr.bin/ssh/channels.c
index 9491c85c11b..97d7178eef6 100644
--- a/usr.bin/ssh/channels.c
+++ b/usr.bin/ssh/channels.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.c,v 1.415 2022/03/30 21:10:25 djm Exp $ */
+/* $OpenBSD: channels.c,v 1.416 2022/04/11 22:52:08 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -2559,7 +2559,12 @@ channel_prepare_poll(struct ssh *ssh, struct pollfd **pfdp, u_int *npfd_allocp,
u_int i, oalloc, p, npfd = npfd_reserved;
channel_before_prepare_io(ssh); /* might create a new channel */
-
+ /* clear out I/O flags from last poll */
+ for (i = 0; i < sc->channels_alloc; i++) {
+ if (sc->channels[i] == NULL)
+ continue;
+ sc->channels[i]->io_want = sc->channels[i]->io_ready = 0;
+ }
/* Allocate 4x pollfd for each channel (rfd, wfd, efd, sock) */
if (sc->channels_alloc >= (INT_MAX / 4) - npfd_reserved)
fatal_f("too many channels"); /* shouldn't happen */