]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuDomainSetupDisk: Initialize 'targetPaths'
authorPeter Krempa <pkrempa@redhat.com>
Tue, 25 Jan 2022 16:49:00 +0000 (17:49 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 26 Jan 2022 08:24:59 +0000 (09:24 +0100)
Compiler isn't able to see that 'virDevMapperGetTargets' in cases e.g.
when the devmapper isn't available may not initialize the value in the
pointer passed as the second argument.

The usage 'qemuDomainSetupDisk' lead to an accidental infinite loop as
previous calls apparently doctored the stack to a point where
'g_slist_concat' would end up in an infinite loop trying to find the end
of the list.

Fixes: 6c49c2ee9fcb88de02cdc333f666a8e95d60a3b0
Closes: https://gitlab.com/libvirt/libvirt/-/issues/268
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
src/qemu/qemu_namespace.c

index 23b1160c5e009c618ab410805a44af087ba6a2fe..94453033f5c58d338c07d5a32b9ff2fa530594cf 100644 (file)
@@ -251,7 +251,7 @@ qemuDomainSetupDisk(virStorageSource *src,
             if (!(tmpPath = virPCIDeviceAddressGetIOMMUGroupDev(&next->nvme->pciAddr)))
                 return -1;
         } else {
-            GSList *targetPaths;
+            GSList *targetPaths = NULL;
 
             if (virStorageSourceIsEmpty(next) ||
                 !virStorageSourceIsLocalStorage(next)) {