nodedev: Unlock @priv if initialization of mdevctlMonitors fails

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>
This commit is contained in:
Michal Privoznik 2021-04-12 16:18:24 +02:00
parent 88e9f30402
commit 9cfcc296fe

View File

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