diff mbox

[RFC/PATCH,3] kvm: fix events.flags (KVM_VCPUEVENT_VALID_SMM) overwritten by 0

Message ID 57E38EAC.3020108@huawei.com (mailing list archive)
State New, archived
Headers show

Commit Message

Herongguang (Stephen) Sept. 22, 2016, 7:56 a.m. UTC
Fix events.flags (KVM_VCPUEVENT_VALID_SMM) overwritten by 0.

Signed-off-by: He Rongguang <herongguang.he@huawei.com>
---
Note without patch 2, this would result in kvm-kmod crash, as described in patch 2
---
  target-i386/kvm.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

--
1.8.3.4
diff mbox

Patch

diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index d1a25c5..7db33d2 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -2456,6 +2456,7 @@  static int kvm_put_vcpu_events(X86CPU *cpu, int level)

      events.sipi_vector = env->sipi_vector;

+    events.flags = 0;
      if (has_msr_smbase) {
          events.smi.smm = !!(env->hflags & HF_SMM_MASK);
          events.smi.smm_inside_nmi = !!(env->hflags2 & HF2_SMM_INSIDE_NMI_MASK);
@@ -2474,7 +2475,6 @@  static int kvm_put_vcpu_events(X86CPU *cpu, int level)
          events.flags |= KVM_VCPUEVENT_VALID_SMM;
      }

-    events.flags = 0;
      if (level >= KVM_PUT_RESET_STATE) {
          events.flags |=
              KVM_VCPUEVENT_VALID_NMI_PENDING | KVM_VCPUEVENT_VALID_SIPI_VECTOR;