qrexec: fix pending requests cleanup code

There was a logic error in pending requests cleanup code, causing
policy_pending_max being set to 0, even if there were more pending
requests. This effectively limited maximum pending requests to 1, after
some system uptime, because policy_pending_max set to 0 makes the code
looks only at the first pending request slot.

While at it, remove outdated FIXME comment, actually this bug is in the
code implementing this FIXME.

Fixes QubesOS/qubes-issues#2699
This commit is contained in:
Marek Marczykowski-Górecki 2017-03-13 03:10:39 +01:00
parent 4f0878ccbf
commit dad208a0d5
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -590,8 +590,6 @@ static void reap_children()
pid_t pid;
while ((pid=waitpid(-1, &status, WNOHANG)) > 0) {
/* FIXME: perhaps keep max(policy_pending) somewhere to optimize this
* search */
for (i = 0; i <= policy_pending_max; i++) {
if (policy_pending[i].pid == pid) {
status = WEXITSTATUS(status);
@ -602,7 +600,7 @@ static void reap_children()
* MSG_SERVICE_CONNECT from client handler */
policy_pending[i].pid = 0;
while (policy_pending_max > 0 &&
policy_pending[policy_pending_max].pid > 0)
policy_pending[policy_pending_max].pid == 0)
policy_pending_max--;
break;
}