libvirt/libvirt-qemu-Init-ext-devic...

42 lines
1.5 KiB
Diff

From aeb0e68bdfee244d14bdd5177b1f559bff76f473 Mon Sep 17 00:00:00 2001
Message-Id: <aeb0e68bdfee244d14bdd5177b1f559bff76f473@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Mon, 5 Dec 2022 13:08:39 +0100
Subject: [PATCH] qemu: Init ext devices paths on reconnect
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Paths for external devices (well, so far only vTPM) are not
stored in the status XML. Therefore, we need to regenerate them
after we've been restarted and reconnecting to a running domain.
Otherwise these will remain NULL which may later lead to a NULL
dereference.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2150760
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 7a2034127010598b91fa576f72f330baf50c1085)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_process.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 19b9242623..c542be5036 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8896,6 +8896,9 @@ qemuProcessReconnect(void *opaque)
if (qemuDomainMasterKeyReadFile(priv) < 0)
goto error;
+ if (qemuExtDevicesInitPaths(driver, obj->def) < 0)
+ goto error;
+
/* If we are connecting to a guest started by old libvirt there is no
* allowReboot in status XML and we need to initialize it. */
qemuProcessPrepareAllowReboot(obj);
--
2.38.1