Skip to contentSkip to conversation

KVM: Fix NULL pointer reference by update_cr8_intercept()

PATCH In review Sheng Yang 2 participants 2 messages Aug 19, 2009

Subsystems (3)
lore
Share & tools
lore

Sheng Yang

author
#0 lore raw

PATCH 1/1 KVM: Fix NULL pointer reference by update_cr8_intercept()

Commit 0d11419a result in NULL pointer reference when using --no-kvm-irqchip.

---
 arch/x86/kvm/x86.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/x86/kvm/x86.c +2 -1
index 850cf56..9ac2d9e 100644
@@ -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 &&
Signature · 1 line
1.5.4.5
#1 lore raw
Quoted 13 lines · Sheng Yang

Commit 0d11419a result in NULL pointer reference when using --no-kvm-irqchip.

---
  arch/x86/kvm/x86.c |    3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)
arch/x86/kvm/x86.c +0 -0
index 850cf56..9ac2d9e 100644

arch/x86/kvm/x86.c int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, · line 4459

Quoted 8 lines
arch/x86/kvm/x86.c +2 -1
@@ -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);
 
 

Thanks, I already have a similar fix in update_cr8_intercept() (since it can be called from another callsite as well). Please check kvm-next.

Signature · 1 line
error compiling committee.c: too many arguments to function