Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1204463

[PATCH] xen/xenbus: Don't leak memory when unmapping the ring on HVM backend

From Julien Grall <julien.grall@citrix.com>
Newsgroups linux.kernel
Subject [PATCH] xen/xenbus: Don't leak memory when unmapping the ring on HVM backend
Date 2015-08-10 20:20 +0200
Message-ID <pVZPX-5HD-15@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


The commit ccc9d90a9a8b5c4ad7e9708ec41f75ff9e98d61d "xenbus_client:
Extend interface to support multi-page ring" removes the call to
free_xenballooned_pages in xenbus_unmap_ring_vfree_hvm.

This will result to not give back the pages to Linux and loose them
forever. It only happens when the backends are running in HVM domains.

Signed-off-by: Julien Grall <julien.grall@citrix.com>

---
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>

Appeared in Linux 4.1. HVM backend, which is always the case on ARM, will
leak every mapped ring (i.e ~12KB per domain with 1 disk and 1 vif).
---
 drivers/xen/xenbus/xenbus_client.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c
index 9ad3272..e303535 100644
--- a/drivers/xen/xenbus/xenbus_client.c
+++ b/drivers/xen/xenbus/xenbus_client.c
@@ -814,8 +814,10 @@ static int xenbus_unmap_ring_vfree_hvm(struct xenbus_device *dev, void *vaddr)
 
 	rv = xenbus_unmap_ring(dev, node->handles, node->nr_handles,
 			       addrs);
-	if (!rv)
+	if (!rv) {
 		vunmap(vaddr);
+		free_xenballooned_pages(node->nr_handles, node->hvm.pages);
+	}
 	else
 		WARN(1, "Leaking %p, size %u page(s)\n", vaddr,
 		     node->nr_handles);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] xen/xenbus: Don't leak memory when unmapping the ring on HVM backend Julien Grall <julien.grall@citrix.com> - 2015-08-10 20:20 +0200
  Re: [PATCH] xen/xenbus: Don't leak memory when unmapping the ring  on HVM backend Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2015-08-10 20:40 +0200
  Re: [PATCH] xen/xenbus: Don't leak memory when unmapping the ring on  HVM backend Wei Liu <wei.liu2@citrix.com> - 2015-08-10 20:50 +0200
  Re: [Xen-devel] [PATCH] xen/xenbus: Don't leak memory when unmapping  the ring on HVM backend David Vrabel <david.vrabel@citrix.com> - 2015-08-11 12:10 +0200

csiph-web