mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
Remove watches before calling REMOTE_PROC_CLOSE
First calling REMOTE_PROC_CLOSE and then removing watches might lead to a hang as HANGUP event can be triggered before the watches are actually removed but after virConnectPtr is already freed. As a result of that remoteDomainEventFired() would try to lock uninitialized mutex, which would hang for ever.
This commit is contained in:
parent
c2c4abb43b
commit
6ef9d9da5e
@ -1418,11 +1418,6 @@ verify_certificate (virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
static int
|
static int
|
||||||
doRemoteClose (virConnectPtr conn, struct private_data *priv)
|
doRemoteClose (virConnectPtr conn, struct private_data *priv)
|
||||||
{
|
{
|
||||||
if (call (conn, priv, 0, REMOTE_PROC_CLOSE,
|
|
||||||
(xdrproc_t) xdr_void, (char *) NULL,
|
|
||||||
(xdrproc_t) xdr_void, (char *) NULL) == -1)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (priv->eventFlushTimer >= 0) {
|
if (priv->eventFlushTimer >= 0) {
|
||||||
/* Remove timeout */
|
/* Remove timeout */
|
||||||
virEventRemoveTimeout(priv->eventFlushTimer);
|
virEventRemoveTimeout(priv->eventFlushTimer);
|
||||||
@ -1431,6 +1426,11 @@ doRemoteClose (virConnectPtr conn, struct private_data *priv)
|
|||||||
priv->watch = -1;
|
priv->watch = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (call (conn, priv, 0, REMOTE_PROC_CLOSE,
|
||||||
|
(xdrproc_t) xdr_void, (char *) NULL,
|
||||||
|
(xdrproc_t) xdr_void, (char *) NULL) == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
/* Close socket. */
|
/* Close socket. */
|
||||||
if (priv->uses_tls && priv->session) {
|
if (priv->uses_tls && priv->session) {
|
||||||
gnutls_bye (priv->session, GNUTLS_SHUT_RDWR);
|
gnutls_bye (priv->session, GNUTLS_SHUT_RDWR);
|
||||||
|
Loading…
Reference in New Issue
Block a user