[PATCH] fix segfault with -no-kvm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Our PIT implementation calls qemu_kvm_pit_in_kernel without
checking for kvm_enabled() as does everybody else. It will make it
dereference kvm_context pointer wich will be NULL.

Signed-off-by: Glauber Costa <glommer@xxxxxxxxxx>
---
 hw/i8254.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/i8254.c b/hw/i8254.c
index fd0bdfe..34a716c 100644
--- a/hw/i8254.c
+++ b/hw/i8254.c
@@ -478,7 +478,7 @@ void hpet_disable_pit(void)
 {
     PITChannelState *s = &pit_state.channels[0];
 
-    if (qemu_kvm_pit_in_kernel()) {
+    if (kvm_enabled() && qemu_kvm_pit_in_kernel()) {
         if (qemu_kvm_has_pit_state2()) {
             kvm_hpet_disable_kpit();
         } else {
@@ -502,7 +502,7 @@ void hpet_enable_pit(void)
     PITState *pit = &pit_state;
     PITChannelState *s = &pit->channels[0];
 
-    if (qemu_kvm_pit_in_kernel()) {
+    if (kvm_enabled() && qemu_kvm_pit_in_kernel()) {
         if (qemu_kvm_has_pit_state2()) {
             kvm_hpet_enable_kpit();
         } else {
-- 
1.6.2.2

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux