From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Scott Subject: [PATCH] linux_gntshr_munmap: munmap takes a length, not a page count Date: Mon, 1 Sep 2014 13:16:47 +0100 Message-ID: <1409573807-15801-1-git-send-email-dave.scott@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XOQXb-00048m-Ru for xen-devel@lists.xenproject.org; Mon, 01 Sep 2014 12:16:59 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: ian.campbell@citrix.com, David Scott , ian.jackson@eu.citrix.com, david.vrabel@citrix.com, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org This fixes a bug where if a client shares more than 1 page, the munmap call fails to clean up everything. A process which does a lot of sharing and unsharing can run out of resources. Signed-off-by: David Scott --- tools/libxc/xc_linux_osdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libxc/xc_linux_osdep.c b/tools/libxc/xc_linux_osdep.c index 86bff3e..a19e4b6 100644 --- a/tools/libxc/xc_linux_osdep.c +++ b/tools/libxc/xc_linux_osdep.c @@ -847,7 +847,7 @@ static void *linux_gntshr_share_pages(xc_gntshr *xch, xc_osdep_handle h, static int linux_gntshr_munmap(xc_gntshr *xcg, xc_osdep_handle h, void *start_address, uint32_t count) { - return munmap(start_address, count); + return munmap(start_address, count * XC_PAGE_SIZE); } static struct xc_osdep_ops linux_gntshr_ops = { -- 1.7.10.4