[PATCH 1/5] nodedev: Unlock @priv if initialization of mdevctlMonitors fails

Michal Privoznik mprivozn at redhat.com
Mon Apr 12 16:22:20 UTC 2021


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 at redhat.com>
---
 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.26.3




More information about the libvir-list mailing list