* [patch] KVM: fix vcpu freeing bug
@ 2007-01-29 18:46 Ingo Molnar
[not found] ` <20070129184612.GA12235-X9Un+BFzKDI@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Ingo Molnar @ 2007-01-29 18:46 UTC (permalink / raw)
To: kvm-devel
From: Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org>
Subject: [patch] KVM: fix vcpu freeing bug
vcpu_load() can return NULL and it sometimes does in failure paths (for
example when the userspace ABI version is too old) - causing a
preemption count underflow in the ->vcpu_free() later on. So check for
NULL.
Signed-off-by: Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org>
Index: linux/drivers/kvm/kvm_main.c
===================================================================
--- linux.orig/drivers/kvm/kvm_main.c
+++ linux/drivers/kvm/kvm_main.c
@@ -357,7 +357,9 @@ static void kvm_free_physmem(struct kvm
static void kvm_free_vcpu(struct kvm_vcpu *vcpu)
{
- vcpu_load(vcpu->kvm, vcpu_slot(vcpu));
+ if (!vcpu_load(vcpu->kvm, vcpu_slot(vcpu)))
+ return;
+
kvm_mmu_destroy(vcpu);
vcpu_put(vcpu);
kvm_arch_ops->vcpu_free(vcpu);
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-01-30 13:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-29 18:46 [patch] KVM: fix vcpu freeing bug Ingo Molnar
[not found] ` <20070129184612.GA12235-X9Un+BFzKDI@public.gmane.org>
2007-01-30 13:00 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox