diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2009-07-02 20:02:15 -0300 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-08-05 13:58:11 +0300 |
commit | 0ff77873b1318fc2d77a85e70690d3cd6cafbd41 (patch) | |
tree | cb08f8c862a445477aae5a74cb087302336d26e4 /arch | |
parent | e125e7b6944898831b56739a5448e705578bf7e2 (diff) | |
download | blackbird-op-linux-0ff77873b1318fc2d77a85e70690d3cd6cafbd41.tar.gz blackbird-op-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 |