[openssh-commits] [openssh] 01/01: Only return events from ppoll that were requested.

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Apr 1 23:59:11 AEDT 2022

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

dtucker pushed a commit to branch V_8_9
in repository openssh.

commit bc04f2674a8feeea3777e957310f57427f39b7cb
Author: Darren Tucker <dtucker at dtucker.net>
Date:   Fri Apr 1 23:38:44 2022 +1100

    Only return events from ppoll that were requested.
    If the underlying system's select() returns bits that were not in the
    request set, our ppoll() implementation can return revents for events
    not requested, which can apparently cause a hang.  Only return revents
    for activity in the requested event set.  bz#3416, analysis and fix by
    yaroslav.kuzmin at vmssoftware com, ok djm@
 openbsd-compat/bsd-poll.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/openbsd-compat/bsd-poll.c b/openbsd-compat/bsd-poll.c
index 781ee978..9a9794f5 100644
--- a/openbsd-compat/bsd-poll.c
+++ b/openbsd-compat/bsd-poll.c
@@ -91,11 +91,11 @@ ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *tmoutp,
 		fds[i].revents = 0;
 		if (fd == -1)
-		if (FD_ISSET(fd, readfds))
+		if ((fds[i].events & POLLIN) && FD_ISSET(fd, readfds))
 			fds[i].revents |= POLLIN;
-		if (FD_ISSET(fd, writefds))
+		if ((fds[i].events & POLLOUT) && FD_ISSET(fd, writefds))
 			fds[i].revents |= POLLOUT;
-		if (FD_ISSET(fd, exceptfds))
+		if ((fds[i].events & POLLPRI) && FD_ISSET(fd, exceptfds))
 			fds[i].revents |= POLLPRI;

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

More information about the openssh-commits mailing list