render / rpms / libvirt

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