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