|
|
a41c76 |
From eb4cd7cd29f434bae7279b3166aac9f7eb2c2436 Mon Sep 17 00:00:00 2001
|
|
|
a41c76 |
Message-Id: <eb4cd7cd29f434bae7279b3166aac9f7eb2c2436@dist-git>
|
|
|
a41c76 |
From: Michal Privoznik <mprivozn@redhat.com>
|
|
|
a41c76 |
Date: Thu, 19 Mar 2020 19:46:43 +0100
|
|
|
a41c76 |
Subject: [PATCH] qemu: Don't crash when getting targets for a multipath
|
|
|
a41c76 |
MIME-Version: 1.0
|
|
|
a41c76 |
Content-Type: text/plain; charset=UTF-8
|
|
|
a41c76 |
Content-Transfer-Encoding: 8bit
|
|
|
a41c76 |
|
|
|
a41c76 |
In one of my previous commits I've introduced code that creates
|
|
|
a41c76 |
all devices for given (possible) multipath target. But I've made
|
|
|
a41c76 |
a mistake there - the code accesses 'next->path' without checking
|
|
|
a41c76 |
if the disk source is local. Note that the 'next->path' is
|
|
|
a41c76 |
NULL/doesn't make sense for VIR_STORAGE_TYPE_NVME.
|
|
|
a41c76 |
|
|
|
a41c76 |
Fixes: a30078cb832646177defd256e77c632905f1e6d0
|
|
|
a41c76 |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1814947
|
|
|
a41c76 |
|
|
|
a41c76 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
a41c76 |
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
a41c76 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
a41c76 |
(cherry picked from commit aeb909bf9b4c3fa48d017475545df94f7c5d3b3a)
|
|
|
a41c76 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
a41c76 |
Message-Id: <3f21a46399486a42b8dd0fbbac25b75f4f6ac80a.1584643597.git.mprivozn@redhat.com>
|
|
|
a41c76 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
a41c76 |
---
|
|
|
a41c76 |
src/qemu/qemu_domain.c | 23 ++++++++++++-----------
|
|
|
a41c76 |
1 file changed, 12 insertions(+), 11 deletions(-)
|
|
|
a41c76 |
|
|
|
a41c76 |
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
|
|
a41c76 |
index 36a63449b2..3d31e176d1 100644
|
|
|
a41c76 |
--- a/src/qemu/qemu_domain.c
|
|
|
a41c76 |
+++ b/src/qemu/qemu_domain.c
|
|
|
a41c76 |
@@ -15932,7 +15932,6 @@ qemuDomainNamespaceSetupDisk(virDomainObjPtr vm,
|
|
|
a41c76 |
bool hasNVMe = false;
|
|
|
a41c76 |
|
|
|
a41c76 |
for (next = src; virStorageSourceIsBacking(next); next = next->backingStore) {
|
|
|
a41c76 |
- VIR_AUTOSTRINGLIST targetPaths = NULL;
|
|
|
a41c76 |
g_autofree char *tmpPath = NULL;
|
|
|
a41c76 |
|
|
|
a41c76 |
if (next->type == VIR_STORAGE_TYPE_NVME) {
|
|
|
a41c76 |
@@ -15941,6 +15940,8 @@ qemuDomainNamespaceSetupDisk(virDomainObjPtr vm,
|
|
|
a41c76 |
if (!(tmpPath = virPCIDeviceAddressGetIOMMUGroupDev(&next->nvme->pciAddr)))
|
|
|
a41c76 |
return -1;
|
|
|
a41c76 |
} else {
|
|
|
a41c76 |
+ VIR_AUTOSTRINGLIST targetPaths = NULL;
|
|
|
a41c76 |
+
|
|
|
a41c76 |
if (virStorageSourceIsEmpty(next) ||
|
|
|
a41c76 |
!virStorageSourceIsLocalStorage(next)) {
|
|
|
a41c76 |
/* Not creating device. Just continue. */
|
|
|
a41c76 |
@@ -15948,20 +15949,20 @@ qemuDomainNamespaceSetupDisk(virDomainObjPtr vm,
|
|
|
a41c76 |
}
|
|
|
a41c76 |
|
|
|
a41c76 |
tmpPath = g_strdup(next->path);
|
|
|
a41c76 |
- }
|
|
|
a41c76 |
|
|
|
a41c76 |
- if (virStringListAdd(&paths, tmpPath) < 0)
|
|
|
a41c76 |
- return -1;
|
|
|
a41c76 |
+ if (virDevMapperGetTargets(next->path, &targetPaths) < 0 &&
|
|
|
a41c76 |
+ errno != ENOSYS && errno != EBADF) {
|
|
|
a41c76 |
+ virReportSystemError(errno,
|
|
|
a41c76 |
+ _("Unable to get devmapper targets for %s"),
|
|
|
a41c76 |
+ next->path);
|
|
|
a41c76 |
+ return -1;
|
|
|
a41c76 |
+ }
|
|
|
a41c76 |
|
|
|
a41c76 |
- if (virDevMapperGetTargets(next->path, &targetPaths) < 0 &&
|
|
|
a41c76 |
- errno != ENOSYS && errno != EBADF) {
|
|
|
a41c76 |
- virReportSystemError(errno,
|
|
|
a41c76 |
- _("Unable to get devmapper targets for %s"),
|
|
|
a41c76 |
- next->path);
|
|
|
a41c76 |
- return -1;
|
|
|
a41c76 |
+ if (virStringListMerge(&paths, &targetPaths) < 0)
|
|
|
a41c76 |
+ return -1;
|
|
|
a41c76 |
}
|
|
|
a41c76 |
|
|
|
a41c76 |
- if (virStringListMerge(&paths, &targetPaths) < 0)
|
|
|
a41c76 |
+ if (virStringListAdd(&paths, tmpPath) < 0)
|
|
|
a41c76 |
return -1;
|
|
|
a41c76 |
}
|
|
|
a41c76 |
|
|
|
a41c76 |
--
|
|
|
a41c76 |
2.25.1
|
|
|
a41c76 |
|