xen-gntdev: unlock on error path in gntdev_mmap()
authorDan Carpenter <error27@gmail.com>
Sat, 19 Mar 2011 05:45:43 +0000 (08:45 +0300)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 24 Mar 2011 14:32:45 +0000 (10:32 -0400)
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>
drivers/xen/gntdev.c

index 00b3acc..b0f9e8f 100644 (file)
@@ -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;