From 9cfcc296fe641ee5d5c7e7802b1df40dd3749944 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Mon, 12 Apr 2021 16:18:24 +0200 Subject: [PATCH] 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 --- src/node_device/node_device_udev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.47.2