render / rpms / libvirt

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