diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2009-07-03 01:02:15 +0200 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-08-05 12:58:11 +0200 |
commit | 0ff77873b1318fc2d77a85e70690d3cd6cafbd41 (patch) | |
tree | cb08f8c862a445477aae5a74cb087302336d26e4 /arch | |
parent | KVM: Fix KVM_GET_MSR_INDEX_LIST (diff) | |
download | linux-0ff77873b1318fc2d77a85e70690d3cd6cafbd41.tar.xz linux-0ff77873b1318fc2d77a85e70690d3cd6cafbd41.zip |
KVM: PIT: fix kpit_elapsed division by zero
Fix division by zero triggered by latch count command on uninitialized
counter.
Cc: stable@kernel.org
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kvm/i8254.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index 4d6f0d293ee2..21f68e00524f 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c @@ -104,6 +104,9 @@ static s64 __kpit_elapsed(struct kvm *kvm) ktime_t remaining; struct kvm_kpit_state *ps = &kvm->arch.vpit->pit_state; + if (!ps->pit_timer.period) + return 0; + /* * The Counter does not stop when it reaches zero. In * Modes 0, 1, 4, and 5 the Counter ``wraps around'' to |