mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 12:16:20 +00:00
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>
This commit is contained in:
parent
e125e7b694
commit
0ff77873b1
1 changed files with 3 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue