From patchwork Mon Jul 20 22:52:40 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glauber Costa X-Patchwork-Id: 36417 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6KMqktx018240 for ; Mon, 20 Jul 2009 22:52:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754191AbZGTWwm (ORCPT ); Mon, 20 Jul 2009 18:52:42 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754053AbZGTWwm (ORCPT ); Mon, 20 Jul 2009 18:52:42 -0400 Received: from mx2.redhat.com ([66.187.237.31]:52171 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753803AbZGTWwl (ORCPT ); Mon, 20 Jul 2009 18:52:41 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6KMqf9n025704 for ; Mon, 20 Jul 2009 18:52:41 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6KMqeTc030938; Mon, 20 Jul 2009 18:52:41 -0400 Received: from localhost.localdomain (virtlab1.virt.bos.redhat.com [10.16.72.21]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6KMqe5v026895; Mon, 20 Jul 2009 18:52:40 -0400 From: Glauber Costa To: kvm@vger.kernel.org Cc: avi@redhat.com Subject: [PATCH] fix segfault with -no-kvm Date: Mon, 20 Jul 2009 18:52:40 -0400 Message-Id: <1248130360-9453-1-git-send-email-glommer@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 --- 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 {