[PATCH] qemu_extdevice: Do cleanup host only for VIR_DOMAIN_TPM_TYPE_EMULATOR

Michal Privoznik posted 1 patch 1 year, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/d37009e1590c1fb3cd057504112fafe82aac1551.1676019228.git.mprivozn@redhat.com
src/qemu/qemu_extdevice.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
[PATCH] qemu_extdevice: Do cleanup host only for VIR_DOMAIN_TPM_TYPE_EMULATOR
Posted by Michal Privoznik 1 year, 2 months ago
We only set up host for VIR_DOMAIN_TPM_TYPE_EMULATOR and thus
similarly, we should do cleanup for the same type. This also
fixes a crasher, in which qemuTPMEmulatorCleanupHost() accesses
tpm->data.emulator.storagepath which is NULL for
VIR_DOMAIN_TPM_TYPE_EXTERNAL.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2168762
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_extdevice.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c
index f7b2e2e653..fdefe59215 100644
--- a/src/qemu/qemu_extdevice.c
+++ b/src/qemu/qemu_extdevice.c
@@ -162,7 +162,10 @@ qemuExtDevicesCleanupHost(virQEMUDriver *driver,
         return;
 
     for (i = 0; i < def->ntpms; i++) {
-        qemuExtTPMCleanupHost(def->tpms[i], flags, outgoingMigration);
+        virDomainTPMDef *tpm = def->tpms[i];
+
+        if (tpm->type == VIR_DOMAIN_TPM_TYPE_EMULATOR)
+            qemuExtTPMCleanupHost(tpm, flags, outgoingMigration);
     }
 }
 
-- 
2.39.1
Re: [PATCH] qemu_extdevice: Do cleanup host only for VIR_DOMAIN_TPM_TYPE_EMULATOR
Posted by Ján Tomko 1 year, 2 months ago
On a Friday in 2023, Michal Privoznik wrote:
>We only set up host for VIR_DOMAIN_TPM_TYPE_EMULATOR and thus
>similarly, we should do cleanup for the same type. This also
>fixes a crasher, in which qemuTPMEmulatorCleanupHost() accesses
>tpm->data.emulator.storagepath which is NULL for
>VIR_DOMAIN_TPM_TYPE_EXTERNAL.
>
>Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2168762
>Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>---
> src/qemu/qemu_extdevice.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano