]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
remote: add mutex when freeing private callbacks
authorMike Pontillo <mpontillo@digitalocean.com>
Tue, 7 Mar 2023 17:57:56 +0000 (17:57 +0000)
committerMartin Kletzander <mkletzan@redhat.com>
Tue, 7 Mar 2023 22:51:11 +0000 (23:51 +0100)
This commit resolves illegal memory accesses observed via:

  remoteClientFreePrivateCallbacks()
  remoteClientCloseFunc()
  virNetServerClientCloseLocked()
  virNetServerProcessClients()
  daemonServerProcessClients()
  virHashForEach()
  virNetDaemonRun()
  main()

Signed-off-by: Mike Pontillo <mpontillo@digitalocean.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/remote/remote_daemon_dispatch.c

index 250eb51e6bfc87c775e86294910c1aa0fefce693..0d843d63f6a4807d7015268655e971c1ba87e2dd 100644 (file)
@@ -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,