]> xenbits.xensource.com Git - libvirt.git/commitdiff
nodedev: Unlock @priv if initialization of mdevctlMonitors fails
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 12 Apr 2021 14:18:24 +0000 (16:18 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 13 Apr 2021 07:31:51 +0000 (09:31 +0200)
If initialization of priv->mdevctlMonitors fails, then the
control jumps over to cleanup label where nodeStateCleanup() is
called which tries to lock @priv. But since @priv was already
locked before taking the jump a deadlock occurs. The solution is
to jump onto @unlock label, just like the code around is doing.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/node_device/node_device_udev.c

index 7d4e8f5c0b00098321408774c890c1a086e3019c..04e1094e218fed64d7b30f9739246f5a6e935435 100644 (file)
@@ -2274,7 +2274,7 @@ nodeStateInitialize(bool privileged,
     if (!(priv->mdevctlMonitors = monitorFileRecursively(priv,
                                                          mdevctlConfigDir))) {
         virMutexUnlock(&priv->mdevctlLock);
-        goto cleanup;
+        goto unlock;
     }
     virMutexUnlock(&priv->mdevctlLock);