I managed to end up with bad filedescriptors in rrdp.
The result is not pretty since the code will start to spin doing poll()
and read() with read failing but the code does not back off enough to
remove the fd from the poll list.

Fix is simple, instead of marking the request as failed just fail the
request. Setting the state to RRDP_STATE_PARSE_ERROR is only needed if
the xml parser fails (and we need to consume all remaining data).
On read error there is no need to do that, since there is no more data.

-- 
:wq Claudio

Index: rrdp.c
===================================================================
RCS file: /cvs/src/usr.sbin/rpki-client/rrdp.c,v
retrieving revision 1.29
diff -u -p -r1.29 rrdp.c
--- rrdp.c      4 Jan 2023 16:51:34 -0000       1.29
+++ rrdp.c      1 May 2023 07:18:52 -0000
@@ -503,8 +503,8 @@ rrdp_data_handler(struct rrdp *s)
 
        len = read(s->infd, buf, sizeof(buf));
        if (len == -1) {
-               s->state |= RRDP_STATE_PARSE_ERROR;
                warn("%s: read failure", s->local);
+               rrdp_abort_req(s);
                return;
        }
        if ((s->state & RRDP_STATE_PARSE) == 0)

Reply via email to