提交 aeb909bf 编写于 作者: M Michal Privoznik

qemu: Don't crash when getting targets for a multipath

In one of my previous commits I've introduced code that creates
all devices for given (possible) multipath target. But I've made
a mistake there - the code accesses 'next->path' without checking
if the disk source is local. Note that the 'next->path' is
NULL/doesn't make sense for VIR_STORAGE_TYPE_NVME.

Fixes: a30078cb
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1814947Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 7b09dc0a
......@@ -15846,7 +15846,6 @@ qemuDomainNamespaceSetupDisk(virDomainObjPtr vm,
bool hasNVMe = false;
for (next = src; virStorageSourceIsBacking(next); next = next->backingStore) {
VIR_AUTOSTRINGLIST targetPaths = NULL;
g_autofree char *tmpPath = NULL;
if (next->type == VIR_STORAGE_TYPE_NVME) {
......@@ -15855,6 +15854,8 @@ qemuDomainNamespaceSetupDisk(virDomainObjPtr vm,
if (!(tmpPath = virPCIDeviceAddressGetIOMMUGroupDev(&next->nvme->pciAddr)))
return -1;
} else {
VIR_AUTOSTRINGLIST targetPaths = NULL;
if (virStorageSourceIsEmpty(next) ||
!virStorageSourceIsLocalStorage(next)) {
/* Not creating device. Just continue. */
......@@ -15862,10 +15863,6 @@ qemuDomainNamespaceSetupDisk(virDomainObjPtr vm,
}
tmpPath = g_strdup(next->path);
}
if (virStringListAdd(&paths, tmpPath) < 0)
return -1;
if (virDevMapperGetTargets(next->path, &targetPaths) < 0 &&
errno != ENOSYS && errno != EBADF) {
......@@ -15879,6 +15876,10 @@ qemuDomainNamespaceSetupDisk(virDomainObjPtr vm,
return -1;
}
if (virStringListAdd(&paths, tmpPath) < 0)
return -1;
}
/* qemu-pr-helper might require access to /dev/mapper/control. */
if (src->pr &&
virStringListAdd(&paths, QEMU_DEVICE_MAPPER_CONTROL_PATH) < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册