Skip to content

Commit

Permalink
xen-gntdev: unlock on error path in gntdev_mmap()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Konrad Rzeszutek Wilk committed Mar 24, 2011
1 parent 12f0258 commit a93e20a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/xen/gntdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -700,6 +700,8 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
spin_unlock(&priv->lock);
return err;

out_unlock_put:
spin_unlock(&priv->lock);
out_put_map:
if (use_ptemod)
map->vma = NULL;
Expand Down

0 comments on commit a93e20a

Please sign in to comment.