diff options
author | Jiri Denemark <jdenemar@redhat.com> | 2014-01-13 15:46:24 +0100 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2014-01-15 11:02:00 -0700 |
commit | b24979a12fcb8fc82b3a52159d578e7eba2ca466 (patch) | |
tree | bac79f00237b350ad4219623f14c7bffb122d124 | |
parent | 21fb70f0484fb02c66dfad27e638ca9fa34fd362 (diff) | |
download | libvirt-b24979a12fcb8fc82b3a52159d578e7eba2ca466.tar.gz |
Really don't crash if a connection closes early
https://bugzilla.redhat.com/show_bug.cgi?id=1047577
When writing commit 173c291, I missed the fact virNetServerClientClose
unlocks the client object before actually clearing client->sock and thus
it is possible to hit a window when client->keepalive is NULL while
client->sock is not NULL. I was thinking client->sock == NULL was a
better check for a closed connection but apparently we have to go with
client->keepalive == NULL to actually fix the crash.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit 066c8ef6c18bc1faf8b3e10787b39796a7a06cc0)
-rw-r--r-- | src/rpc/virnetserverclient.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c index 147511ee90..36befd0938 100644 --- a/src/rpc/virnetserverclient.c +++ b/src/rpc/virnetserverclient.c @@ -1379,7 +1379,7 @@ virNetServerClientStartKeepAlive(virNetServerClientPtr client) /* The connection might have been closed before we got here and thus the * keepalive object could have been removed too. */ - if (!client->sock) { + if (!client->keepalive) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; |