summaryrefslogtreecommitdiffstats
path: root/kernel/drivers/xen
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/drivers/xen')
-rw-r--r--kernel/drivers/xen/gntdev.c2
-rw-r--r--kernel/drivers/xen/xenbus/xenbus_client.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/kernel/drivers/xen/gntdev.c b/kernel/drivers/xen/gntdev.c
index 892748507..4bd23bba8 100644
--- a/kernel/drivers/xen/gntdev.c
+++ b/kernel/drivers/xen/gntdev.c
@@ -568,12 +568,14 @@ static int gntdev_release(struct inode *inode, struct file *flip)
pr_debug("priv %p\n", priv);
+ mutex_lock(&priv->lock);
while (!list_empty(&priv->maps)) {
map = list_entry(priv->maps.next, struct grant_map, next);
list_del(&map->next);
gntdev_put_map(NULL /* already removed */, map);
}
WARN_ON(!list_empty(&priv->freeable_maps));
+ mutex_unlock(&priv->lock);
if (use_ptemod)
mmu_notifier_unregister(&priv->mn, priv->mm);
diff --git a/kernel/drivers/xen/xenbus/xenbus_client.c b/kernel/drivers/xen/xenbus/xenbus_client.c
index 96b2011d2..658be6cc3 100644
--- a/kernel/drivers/xen/xenbus/xenbus_client.c
+++ b/kernel/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);