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