From patchwork Wed Aug 19 02:52:09 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sheng Yang X-Patchwork-Id: 42482 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 n7J2q8Uf027154 for ; Wed, 19 Aug 2009 02:52:08 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751643AbZHSCwA (ORCPT ); Tue, 18 Aug 2009 22:52:00 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751653AbZHSCwA (ORCPT ); Tue, 18 Aug 2009 22:52:00 -0400 Received: from mga01.intel.com ([192.55.52.88]:27829 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751640AbZHSCwA (ORCPT ); Tue, 18 Aug 2009 22:52:00 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 18 Aug 2009 19:49:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.43,405,1246863600"; d="scan'208";a="718361679" Received: from syang10-desktop.sh.intel.com (HELO syang10-desktop) ([10.239.13.88]) by fmsmga001.fm.intel.com with ESMTP; 18 Aug 2009 19:55:08 -0700 Received: from yasker by syang10-desktop with local (Exim 4.69) (envelope-from ) id 1MdbHV-0007Qe-Mu; Wed, 19 Aug 2009 10:52:09 +0800 From: Sheng Yang To: Avi Kivity Cc: arcezed@gmail.com, kvm@vger.kernel.org, Sheng Yang Subject: [PATCH] KVM: Fix NULL pointer reference by update_cr8_intercept() Date: Wed, 19 Aug 2009 10:52:09 +0800 Message-Id: <1250650329-28537-1-git-send-email-sheng@linux.intel.com> X-Mailer: git-send-email 1.6.0.4 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Commit 0d11419a result in NULL pointer reference when using --no-kvm-irqchip. Signed-off-by: Sheng Yang --- arch/x86/kvm/x86.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 850cf56..9ac2d9e 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -4453,7 +4453,8 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, kvm_set_segment(vcpu, &sregs->tr, VCPU_SREG_TR); kvm_set_segment(vcpu, &sregs->ldt, VCPU_SREG_LDTR); - update_cr8_intercept(vcpu); + if (kvm_lapic_enabled(vcpu)) + update_cr8_intercept(vcpu); /* Older userspace won't unhalt the vcpu on reset. */ if (kvm_vcpu_is_bsp(vcpu) && kvm_rip_read(vcpu) == 0xfff0 &&