Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1e8ba6fba5050ec11bba90c8622aa2ed95ff711f
Commit:     1e8ba6fba5050ec11bba90c8622aa2ed95ff711f
Parent:     8cd133073f9b5cd335c0b2e4740aceb025d50ca9
Author:     Ingo Molnar <[EMAIL PROTECTED]>
AuthorDate: Mon Feb 12 00:54:42 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Mon Feb 12 09:48:40 2007 -0800

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/kvm/kvm_main.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index eb3931c..9b79d34 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -272,7 +272,9 @@ static void kvm_free_physmem(struct kvm *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);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to