]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: Fix local apic timer divide by zero
authorKevin Pedretti <kevin.pedretti@gmail.com>
Sun, 21 Oct 2007 06:54:53 +0000 (08:54 +0200)
committerAvi Kivity <avi@qumranet.com>
Mon, 22 Oct 2007 10:03:29 +0000 (12:03 +0200)
commitaca7ef25b786dbfc951efca0d7bbced65edfb86d
tree749cef5dcdc31bf0221f793ab7260559cfb54226
parent54f4b7de1066a24d2772bc0bf78f6244c1ac8031
KVM: Fix local apic timer divide by zero

kvm_lapic_reset() was initializing apic->timer.divide_count to 0,
which could potentially lead to a divide by zero error in
apic_get_tmcct().  Any guest that reads the APIC's CCR (current count)
register before setting DCR (divide configuration) would trigger a divide
by zero exception in the host kernel, leading to a host-OS crash.

This patch results in apic->timer.divide_count being initialized to
2 at reset, eliminating the bug (DCR=0 at reset, meaning divide by 2).

Signed-off-by: Kevin Pedretti <kevin.pedretti@gmail.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/lapic.c