[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20061228124224.GA28573@elte.hu>
Date: Thu, 28 Dec 2006 13:42:24 +0100
From: Ingo Molnar <mingo@...e.hu>
To: Avi Kivity <avi@...ranet.com>
Cc: kvm-devel <kvm-devel@...ts.sourceforge.net>,
linux-kernel <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...l.org>,
Linus Torvalds <torvalds@...l.org>
Subject: [patch] kvm: fix GFP_KERNEL allocation in atomic section in kvm_dev_ioctl_create_vcpu()
Subject: [patch] kvm: fix GFP_KERNEL allocation in atomic section in kvm_dev_ioctl_create_vcpu()
From: Ingo Molnar <mingo@...e.hu>
fix a GFP_KERNEL allocation in atomic section bug:
kvm_dev_ioctl_create_vcpu() called kvm_mmu_init(), which calls
alloc_pages(), while holding the vcpu. The fix is to set up the MMU
state earlier, it does not require a loaded CPU state.
(NOTE: free_vcpus does an kvm_mmu_destroy() call so there's no need
for any extra teardown branch on allocation failure here.)
found in 2.6.20-rc2-rt1.
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
drivers/kvm/kvm_main.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: linux/drivers/kvm/kvm_main.c
===================================================================
--- linux.orig/drivers/kvm/kvm_main.c
+++ linux/drivers/kvm/kvm_main.c
@@ -522,12 +522,12 @@ static int kvm_dev_ioctl_create_vcpu(str
if (r < 0)
goto out_free_vcpus;
- kvm_arch_ops->vcpu_load(vcpu);
+ r = kvm_mmu_init(vcpu);
+ if (r < 0)
+ goto out_free_vcpus;
+ kvm_arch_ops->vcpu_load(vcpu);
r = kvm_arch_ops->vcpu_setup(vcpu);
- if (r >= 0)
- r = kvm_mmu_init(vcpu);
-
vcpu_put(vcpu);
if (r < 0)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists