From patchwork Sat Jan 17 23:13:10 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hao, Xudong" X-Patchwork-Id: 2604251 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 0FAFD40077 for ; Thu, 23 May 2013 01:02:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756373Ab3EWBCb (ORCPT ); Wed, 22 May 2013 21:02:31 -0400 Received: from mga01.intel.com ([192.55.52.88]:61309 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755901Ab3EWBCb (ORCPT ); Wed, 22 May 2013 21:02:31 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 22 May 2013 18:02:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,724,1363158000"; d="scan'208";a="342018277" Received: from xhao-dev.sh.intel.com (HELO localhost.localdomain) ([10.239.48.48]) by fmsmga002.fm.intel.com with ESMTP; 22 May 2013 18:02:29 -0700 From: Xudong Hao To: kvm@vger.kernel.org Cc: gleb@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org, Xudong Hao Subject: [PATCH] qemu-kvm: fix unmatched RAM alloction/free Date: Sun, 18 Jan 2009 07:13:10 +0800 Message-Id: <1232233990-20383-1-git-send-email-xudong.hao@intel.com> X-Mailer: git-send-email 1.5.5 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org mmap is used in qemu_vmalloc function instead of qemu_memalign(commit 7dda5dc8), so it should change qemu_vfree to munmap to fix a unmatched issue. This issue appears when a PCI device is being assigned to KVM guest, failure to read PCI rom file will bring RAM free, then the incorrect qemu_vfree calling will cause a segment fault. Signed-off-by: Xudong Hao --- exec.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/exec.c b/exec.c index fa1e0c3..d40d237 100644 --- a/exec.c +++ b/exec.c @@ -1152,15 +1152,11 @@ void qemu_ram_free(ram_addr_t addr) abort(); #endif } else { -#if defined(TARGET_S390X) && defined(CONFIG_KVM) - munmap(block->host, block->length); -#else if (xen_enabled()) { xen_invalidate_map_cache_entry(block->host); } else { - qemu_vfree(block->host); + munmap(block->host, block->length); } -#endif } g_free(block); break;