From patchwork Fri Jun 17 11:13:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 891172 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5HBIeso019766 for ; Fri, 17 Jun 2011 11:18:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756532Ab1FQLPi (ORCPT ); Fri, 17 Jun 2011 07:15:38 -0400 Received: from mail-vx0-f174.google.com ([209.85.220.174]:33305 "EHLO mail-vx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756452Ab1FQLPh (ORCPT ); Fri, 17 Jun 2011 07:15:37 -0400 Received: by vxi39 with SMTP id 39so1870725vxi.19 for ; Fri, 17 Jun 2011 04:15:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=fy74/Q0wlg/bIGmQVXmQtc4h1vz+mzzEB0KHkrTMUVE=; b=vcI5l1Omkb+Op0iZjLShkXBiDrJ0bRYj0pkW58txRbnL+VK9Y+XA4AQAUTrnBbmEs3 qZXq1SzoESpLXHwbXOlKM9RENk1N1cO60iLmC/n8P5bhFDEH4mAd8mp8s2XNvvX+3YbW VJxVlBUvLw+EQdkmODUzO36iVquZ8l+bYX/SU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=vZ2jaIvqpt2cxCt8dZ44EccMhmg4CjQPUculgXjEDP4F/YDD/RUKwYoeesxFHAzg05 1cjBLiSMCOBO5CWrA+4GrL0WCD98o+fuTLEY2w9qOYcdT2fmCSyxEFx2yhMHVPZW5yYA aD0RMsTJUwo2rZKpCRFN4NJnKpmik3aAAYMhE= Received: by 10.220.178.66 with SMTP id bl2mr744406vcb.94.1308309336740; Fri, 17 Jun 2011 04:15:36 -0700 (PDT) Received: from localhost.localdomain (c-71-232-157-243.hsd1.ma.comcast.net [71.232.157.243]) by mx.google.com with ESMTPS id o2sm374722vct.43.2011.06.17.04.15.35 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 17 Jun 2011 04:15:36 -0700 (PDT) From: Sasha Levin To: penberg@kernel.org Cc: kvm@vger.kernel.org, mingo@elte.hu, asias.hejun@gmail.com, gorcunov@gmail.com, prasadjoshi124@gmail.com, Sasha Levin Subject: [PATCH] kvm tools: Fix attempt to free mmaped memory Date: Fri, 17 Jun 2011 07:13:16 -0400 Message-Id: <1308309196-4757-1-git-send-email-levinsasha928@gmail.com> X-Mailer: git-send-email 1.7.5.3 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 17 Jun 2011 11:18:43 +0000 (UTC) Framebuffer memory which was mmap() is being free() at the shutdown of the guest, leading to glibc errors. Signed-off-by: Sasha Levin --- tools/kvm/framebuffer.c | 3 ++- tools/kvm/hw/vesa.c | 1 + tools/kvm/include/kvm/framebuffer.h | 1 + 3 files changed, 4 insertions(+), 1 deletions(-) diff --git a/tools/kvm/framebuffer.c b/tools/kvm/framebuffer.c index 1e35496..b6eb1ac 100644 --- a/tools/kvm/framebuffer.c +++ b/tools/kvm/framebuffer.c @@ -3,6 +3,7 @@ #include #include #include +#include static LIST_HEAD(framebuffers); @@ -62,6 +63,6 @@ void fb__stop(void) struct framebuffer *fb; list_for_each_entry(fb, &framebuffers, node) { - free(fb->mem); + munmap(fb->mem, fb->mem_size); } } diff --git a/tools/kvm/hw/vesa.c b/tools/kvm/hw/vesa.c index 71322fc..032e630 100644 --- a/tools/kvm/hw/vesa.c +++ b/tools/kvm/hw/vesa.c @@ -70,6 +70,7 @@ struct framebuffer *vesa__init(struct kvm *kvm) .depth = VESA_BPP, .mem = mem, .mem_addr = VESA_MEM_ADDR, + .mem_size = VESA_MEM_SIZE, }; return fb__register(&vesafb); } diff --git a/tools/kvm/include/kvm/framebuffer.h b/tools/kvm/include/kvm/framebuffer.h index d28dadb..b66d0ba 100644 --- a/tools/kvm/include/kvm/framebuffer.h +++ b/tools/kvm/include/kvm/framebuffer.h @@ -20,6 +20,7 @@ struct framebuffer { u8 depth; char *mem; u64 mem_addr; + u64 mem_size; unsigned long nr_targets; struct fb_target_operations *targets[FB_MAX_TARGETS];