Subject: [patch] kvm: fix GFP_KERNEL allocation in atomic section in kvm_dev_ioctl_create_vcpu() From: Ingo Molnar <[EMAIL PROTECTED]>
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 <[EMAIL PROTECTED]> --- 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 [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/