]> xenbits.xensource.com Git - xen.git/commitdiff
tools/xenstored: close socket connections on error
authorManuel Bouyer <bouyer@netbsd.org>
Wed, 3 Feb 2021 16:54:19 +0000 (17:54 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 4 Feb 2021 21:26:41 +0000 (21:26 +0000)
On error, don't keep socket connection in ignored state but close them.
When the remote end of a socket is closed, xenstored will flag it as an
error and switch the connection to ignored. But on some OSes (e.g.
NetBSD), poll(2) will return only POLLIN in this case, so sockets in ignored
state will stay open forever in xenstored (and it will loop with CPU 100%
busy).

Fixes: d2fa370d3ef9 ("tools/xenstore: Preserve bad client until they are destroyed")
Signed-off-by: Manuel Bouyer <bouyer@netbsd.org>
Reviewed-by: Juergen Gross <jgross@suse.com>
Release-Acked-by: Ian Jackson <iwj@xenproject.org>
tools/xenstore/xenstored_core.c

index 1ab6f162cb650c76336ccc1da01bec4d0162c690..0fea598352645ba4f5f03efda3e29b579a7ba03f 100644 (file)
@@ -1440,6 +1440,9 @@ static void ignore_connection(struct connection *conn)
 
        talloc_free(conn->in);
        conn->in = NULL;
+       /* if this is a socket connection, drop it now */
+       if (conn->fd >= 0)
+               talloc_free(conn);
 }
 
 static const char *sockmsg_string(enum xsd_sockmsg_type type)