diff options
author | Markus Armbruster <armbru@redhat.com> | 2021-07-20 14:53:58 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2021-08-26 17:15:28 +0200 |
commit | a5c051b2cf11197b1663dfb470e80dbc32d77cd0 (patch) | |
tree | 23b1c3b779bf8caf6e72b6001315868ea0c5a050 /target | |
parent | aa6f7448ebef35249374508c503f53a8859d8a1e (diff) | |
download | qemu-a5c051b2cf11197b1663dfb470e80dbc32d77cd0.zip qemu-a5c051b2cf11197b1663dfb470e80dbc32d77cd0.tar.gz qemu-a5c051b2cf11197b1663dfb470e80dbc32d77cd0.tar.bz2 |
i386: Never free migration blocker objects instead of sometimes
invtsc_mig_blocker has static storage duration. When a CPU with
certain features is initialized, and invtsc_mig_blocker is still null,
we add a migration blocker and store it in invtsc_mig_blocker.
The object is freed when migrate_add_blocker() fails, leaving
invtsc_mig_blocker dangling. It is not freed on later failures.
Same for hv_passthrough_mig_blocker and hv_no_nonarch_cs_mig_blocker.
All failures are actually fatal, so whether we free or not doesn't
really matter, except as bad examples to be copied / imitated.
Clean this up in a minimal way: never free these blocker objects.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210720125408.387910-7-armbru@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'target')
-rw-r--r-- | target/i386/kvm/kvm.c | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index e69abe4..57aed52 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -1437,7 +1437,6 @@ static int hyperv_init_vcpu(X86CPU *cpu) ret = migrate_add_blocker(hv_passthrough_mig_blocker, &local_err); if (local_err) { error_report_err(local_err); - error_free(hv_passthrough_mig_blocker); return ret; } } @@ -1452,7 +1451,6 @@ static int hyperv_init_vcpu(X86CPU *cpu) ret = migrate_add_blocker(hv_no_nonarch_cs_mig_blocker, &local_err); if (local_err) { error_report_err(local_err); - error_free(hv_no_nonarch_cs_mig_blocker); return ret; } } @@ -1892,7 +1890,6 @@ int kvm_arch_init_vcpu(CPUState *cs) r = migrate_add_blocker(invtsc_mig_blocker, &local_err); if (local_err) { error_report_err(local_err); - error_free(invtsc_mig_blocker); return r; } } |