From patchwork Mon Apr 8 07:26:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Yang Z" X-Patchwork-Id: 2405301 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id DCD403FC71 for ; Mon, 8 Apr 2013 07:31:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933603Ab3DHHbA (ORCPT ); Mon, 8 Apr 2013 03:31:00 -0400 Received: from mga03.intel.com ([143.182.124.21]:27224 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932739Ab3DHHbA (ORCPT ); Mon, 8 Apr 2013 03:31:00 -0400 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 08 Apr 2013 00:30:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,429,1363158000"; d="scan'208";a="282865881" Received: from yang-desktop.sh.intel.com ([10.239.47.153]) by azsmga001.ch.intel.com with ESMTP; 08 Apr 2013 00:30:58 -0700 From: Yang Zhang To: kvm@vger.kernel.org Cc: Yang Zhang Subject: [PATCH] KVM: x86: fix memory leak in vmx_init Date: Mon, 8 Apr 2013 15:26:33 +0800 Message-Id: <1365405993-29792-1-git-send-email-yang.z.zhang@intel.com> X-Mailer: git-send-email 1.7.1.1 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Yang Zhang Free vmx_msr_bitmap_longmode_x2apic and vmx_msr_bitmap_longmode if kvm_init() fails. Signed-off-by: Yang Zhang --- arch/x86/kvm/vmx.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 03f5746..c6da8c5 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -7741,7 +7741,7 @@ static int __init vmx_init(void) r = kvm_init(&vmx_x86_ops, sizeof(struct vcpu_vmx), __alignof__(struct vcpu_vmx), THIS_MODULE); if (r) - goto out3; + goto out5; #ifdef CONFIG_KEXEC rcu_assign_pointer(crash_vmclear_loaded_vmcss, @@ -7789,6 +7789,8 @@ static int __init vmx_init(void) return 0; +out5: + free_page((unsigned long)vmx_msr_bitmap_longmode_x2apic); out4: free_page((unsigned long)vmx_msr_bitmap_longmode); out3: