diff options
author | Dan Carpenter <error27@gmail.com> | 2011-03-19 01:45:43 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-03-24 10:32:45 -0400 |
commit | a93e20a83077f57638f8574b1c072ce6712e95ec (patch) | |
tree | 1cb7c814949381ae44638ca9bd62c81432c94abf /drivers | |
parent | 12f0258d5b44b3b5a9442ec461bbac1f7edab8c6 (diff) |
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.c | 4 |
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) | |||
662 | if (map->flags) { | 662 | if (map->flags) { |
663 | if ((vma->vm_flags & VM_WRITE) && | 663 | if ((vma->vm_flags & VM_WRITE) && |
664 | (map->flags & GNTMAP_readonly)) | 664 | (map->flags & GNTMAP_readonly)) |
665 | return -EINVAL; | 665 | goto out_unlock_put; |
666 | } else { | 666 | } else { |
667 | map->flags = GNTMAP_host_map; | 667 | map->flags = GNTMAP_host_map; |
668 | if (!(vma->vm_flags & VM_WRITE)) | 668 | if (!(vma->vm_flags & VM_WRITE)) |
@@ -700,6 +700,8 @@ unlock_out: | |||
700 | spin_unlock(&priv->lock); | 700 | spin_unlock(&priv->lock); |
701 | return err; | 701 | return err; |
702 | 702 | ||
703 | out_unlock_put: | ||
704 | spin_unlock(&priv->lock); | ||
703 | out_put_map: | 705 | out_put_map: |
704 | if (use_ptemod) | 706 | if (use_ptemod) |
705 | map->vma = NULL; | 707 | map->vma = NULL; |