From 773c464ddbbc39b8cec88984160eb2603f2c445e Mon Sep 17 00:00:00 2001 From: dtucker Date: Thu, 10 Jun 2021 03:14:14 +0000 Subject: [PATCH] Continue accept loop when pselect returns -1, eg if it was interrupted by a signal. This should prevent the hang discovered by sthen@ wherein sshd receives a SIGHUP while it has an unauthenticated child and goes on to a blocking read on a notify_pipe. feedback deraadt@, ok djm@ --- usr.bin/ssh/sshd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c index 0bd010dae93..69f68132856 100644 --- a/usr.bin/ssh/sshd.c +++ b/usr.bin/ssh/sshd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshd.c,v 1.575 2021/06/06 11:34:16 djm Exp $ */ +/* $OpenBSD: sshd.c,v 1.576 2021/06/10 03:14:14 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -1159,7 +1159,7 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s) if (ret == -1 && errno != EINTR) error("pselect: %.100s", strerror(errno)); sigprocmask(SIG_SETMASK, &osigset, NULL); - if (received_sigterm) + if (ret == -1) continue; for (i = 0; i < options.max_startups; i++) { -- 2.20.1