comparison common-session.c @ 1191:b370b4b172d0

Fix ses.channel_signal_pending race
author Matt Johnston <matt@ucc.asn.au>
date Fri, 27 Nov 2015 21:26:43 +0800
parents a550e1e2e2a9
children 9169e4e7cbee
comparison
equal deleted inserted replaced
1190:6ae081e631db 1191:b370b4b172d0
160 dropbear_assert(ses.payload == NULL); 160 dropbear_assert(ses.payload == NULL);
161 161
162 /* We get woken up when signal handlers write to this pipe. 162 /* We get woken up when signal handlers write to this pipe.
163 SIGCHLD in svr-chansession is the only one currently. */ 163 SIGCHLD in svr-chansession is the only one currently. */
164 FD_SET(ses.signal_pipe[0], &readfd); 164 FD_SET(ses.signal_pipe[0], &readfd);
165 ses.channel_signal_pending = 0;
165 166
166 /* set up for channels which can be read/written */ 167 /* set up for channels which can be read/written */
167 setchannelfds(&readfd, &writefd, writequeue_has_space); 168 setchannelfds(&readfd, &writefd, writequeue_has_space);
168 169
169 /* Pending connections to test */ 170 /* Pending connections to test */
209 /* We'll just empty out the pipe if required. We don't do 210 /* We'll just empty out the pipe if required. We don't do
210 any thing with the data, since the pipe's purpose is purely to 211 any thing with the data, since the pipe's purpose is purely to
211 wake up the select() above. */ 212 wake up the select() above. */
212 if (FD_ISSET(ses.signal_pipe[0], &readfd)) { 213 if (FD_ISSET(ses.signal_pipe[0], &readfd)) {
213 char x; 214 char x;
215 TRACE(("signal pipe set"))
214 while (read(ses.signal_pipe[0], &x, 1) > 0) {} 216 while (read(ses.signal_pipe[0], &x, 1) > 0) {}
217 ses.channel_signal_pending = 1;
215 } 218 }
216 219
217 /* check for auth timeout, rekeying required etc */ 220 /* check for auth timeout, rekeying required etc */
218 checktimeouts(); 221 checktimeouts();
219 222