kvm: x86: Check kvm_write_guest return value in kvm_write_wall_clock
authorNicholas Krause <xerofoify@gmail.com>
Wed, 30 Dec 2015 18:08:46 +0000 (13:08 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 7 Jan 2016 13:51:32 +0000 (14:51 +0100)
This makes sure the wall clock is updated only after an odd version value
is successfully written to guest memory.

Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c

index b6102c1eb3b1f6da8f3c218dc89a9ceff7ff5aa2..102c3028513f6f68c24f046200b242fd4ee8dcf3 100644 (file)
@@ -1169,7 +1169,8 @@ static void kvm_write_wall_clock(struct kvm *kvm, gpa_t wall_clock)
 
        ++version;
 
-       kvm_write_guest(kvm, wall_clock, &version, sizeof(version));
+       if (kvm_write_guest(kvm, wall_clock, &version, sizeof(version)))
+               return;
 
        /*
         * The guest calculates current wall clock time by adding