summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2011-03-19 06:45:43 +0100
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2011-03-24 15:32:45 +0100
commita93e20a83077f57638f8574b1c072ce6712e95ec (patch)
tree1cb7c814949381ae44638ca9bd62c81432c94abf /drivers
parentxen-gntdev: return -EFAULT on copy_to_user failure (diff)
downloadlinux-a93e20a83077f57638f8574b1c072ce6712e95ec.tar.xz
linux-a93e20a83077f57638f8574b1c072ce6712e95ec.zip
xen-gntdev: unlock on error path in gntdev_mmap()
We should unlock here and also decrement the number of &map->users. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/xen/gntdev.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
index 00b3accc43ee..b0f9e8fb0052 100644
--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -662,7 +662,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
if (map->flags) {
if ((vma->vm_flags & VM_WRITE) &&
(map->flags & GNTMAP_readonly))
- return -EINVAL;
+ goto out_unlock_put;
} else {
map->flags = GNTMAP_host_map;
if (!(vma->vm_flags & VM_WRITE))
@@ -700,6 +700,8 @@ unlock_out:
spin_unlock(&priv->lock);
return err;
+out_unlock_put:
+ spin_unlock(&priv->lock);
out_put_map:
if (use_ptemod)
map->vma = NULL;