From: Mike Pontillo Date: Tue, 7 Mar 2023 17:57:56 +0000 (+0000) Subject: remote: add mutex when freeing private callbacks X-Git-Tag: v9.2.0-rc1~137 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6386dd897df596a01e3cf0db9f86d496891564dc;p=thirdparty%2Flibvirt.git remote: add mutex when freeing private callbacks This commit resolves illegal memory accesses observed via: remoteClientFreePrivateCallbacks() remoteClientCloseFunc() virNetServerClientCloseLocked() virNetServerProcessClients() daemonServerProcessClients() virHashForEach() virNetDaemonRun() main() Signed-off-by: Mike Pontillo Reviewed-by: Martin Kletzander --- diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c index 250eb51e6b..0d843d63f6 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1709,6 +1709,8 @@ static void remoteClientFreePrivateCallbacks(struct daemonClientPrivate *priv) { g_autoptr(virIdentity) sysident = virIdentityGetSystem(); + VIR_LOCK_GUARD lock = virLockGuardLock(&priv->lock); + virIdentitySetCurrent(sysident); DEREG_CB(priv->conn, priv->domainEventCallbacks,