WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [patch 2/2] xen-gntdev: unlock on error path in gntdev_mmap(

To: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
Subject: [Xen-devel] [patch 2/2] xen-gntdev: unlock on error path in gntdev_mmap()
From: Dan Carpenter <error27@xxxxxxxxx>
Date: Sat, 19 Mar 2011 08:45:43 +0300
Cc: kernel-janitors@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx, virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Delivery-date: Thu, 24 Mar 2011 16:51:17 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=ISXWx8qOX6AC3qk65qX0Fa2Q2BSZzpLD+fqC0aTAB78=; b=MKeUvP+FqIjUz3AeqxZmi6/up75IZaTv10f+1gXp7ANaQLruuZbwq9IJCgitrD8n4L N0xsZx8WGs9IcoybpgYMNt/mbPRo2TNUU6VmT5EDUy8nfgE/SVrnydNrQ3e5CQLBNCdi 3d+ZlAeYGdDMF72hmgDYXtLsaxk/UYDmpk2eU=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=RaIZXsk5zvCshMzGWIze6QQP4GdSdymXjLhNkfUo42YRcAikqe3SdZcQrhhz+jwaeF u6h7qrDAPm71tO1qQBjnfbS5NK+narD3UhmQSUQs3xpTRm9jSy87niT6wFZJb0J7ocvM 6UIAXGTseyRpx94osufYThUuGrWI0ZsQSkNkw=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.20 (2009-06-14)
We should unlock here and also decrement the number of &map->users.

Signed-off-by: Dan Carpenter <error27@xxxxxxxxx>
---
I'm not very familiar with this code.  Please review carefully.

diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
index 017ce60..b0f9e8f 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;

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>