render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
954c63
From 0eec7bae9f59b2693798d25d346243109e92aeff Mon Sep 17 00:00:00 2001
954c63
Message-Id: <0eec7bae9f59b2693798d25d346243109e92aeff@dist-git>
954c63
From: Peter Krempa <pkrempa@redhat.com>
954c63
Date: Tue, 25 Jan 2022 17:49:00 +0100
954c63
Subject: [PATCH] qemuDomainSetupDisk: Initialize 'targetPaths'
954c63
954c63
Compiler isn't able to see that 'virDevMapperGetTargets' in cases e.g.
954c63
when the devmapper isn't available may not initialize the value in the
954c63
pointer passed as the second argument.
954c63
954c63
The usage 'qemuDomainSetupDisk' lead to an accidental infinite loop as
954c63
previous calls apparently doctored the stack to a point where
954c63
'g_slist_concat' would end up in an infinite loop trying to find the end
954c63
of the list.
954c63
954c63
Fixes: 6c49c2ee9fcb88de02cdc333f666a8e95d60a3b0
954c63
Closes: https://gitlab.com/libvirt/libvirt/-/issues/268
954c63
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
954c63
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
954c63
(cherry picked from commit ddb2384f0c78a91c40d95afdbc7fe325e95ef2bc)
954c63
https://bugzilla.redhat.com/show_bug.cgi?id=2046170
954c63
---
954c63
 src/qemu/qemu_namespace.c | 2 +-
954c63
 1 file changed, 1 insertion(+), 1 deletion(-)
954c63
954c63
diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c
954c63
index 23b1160c5e..94453033f5 100644
954c63
--- a/src/qemu/qemu_namespace.c
954c63
+++ b/src/qemu/qemu_namespace.c
954c63
@@ -251,7 +251,7 @@ qemuDomainSetupDisk(virStorageSource *src,
954c63
             if (!(tmpPath = virPCIDeviceAddressGetIOMMUGroupDev(&next->nvme->pciAddr)))
954c63
                 return -1;
954c63
         } else {
954c63
-            GSList *targetPaths;
954c63
+            GSList *targetPaths = NULL;
954c63
 
954c63
             if (virStorageSourceIsEmpty(next) ||
954c63
                 !virStorageSourceIsLocalStorage(next)) {
954c63
-- 
954c63
2.35.1
954c63