From: Michal Privoznik Date: Mon, 12 Apr 2021 14:18:24 +0000 (+0200) Subject: nodedev: Unlock @priv if initialization of mdevctlMonitors fails X-Git-Tag: v7.3.0-rc1~239 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9cfcc296fe641ee5d5c7e7802b1df40dd3749944;p=thirdparty%2Flibvirt.git 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 Reviewed-by: Pavel Hrdina --- diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index 7d4e8f5c0b..04e1094e21 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -2274,7 +2274,7 @@ nodeStateInitialize(bool privileged, if (!(priv->mdevctlMonitors = monitorFileRecursively(priv, mdevctlConfigDir))) { virMutexUnlock(&priv->mdevctlLock); - goto cleanup; + goto unlock; } virMutexUnlock(&priv->mdevctlLock);