From: Manuel Bouyer Date: Wed, 3 Feb 2021 16:54:19 +0000 (+0100) Subject: tools/xenstored: close socket connections on error X-Git-Tag: archive/raspbian/4.16.0+51-g0941d6cb-1+rpi1~2^2~42^2~943 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=cd09c4929e9b70d77747ec187ea94731c8a06ab2;p=xen.git tools/xenstored: close socket connections on error 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 Reviewed-by: Juergen Gross Release-Acked-by: Ian Jackson --- diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c index 1ab6f162cb..0fea598352 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -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)