Skip to contentSkip to conversation

xen-gntdev: unlock on error path in gntdev_mmap()

PATCH In review Dan Carpenter 2 participants 3 messages Mar 19, 2011 – Mar 25, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 xen-gntdev: unlock on error path in gntdev_mmap()

We should unlock here and also decrement the number of &map->users.

---
I'm not very familiar with this code. Please review carefully.

drivers/xen/gntdev.c +3 -1
index 017ce60..b0f9e8f 100644
@@ -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;
#1 lore raw

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

Quoted 5 lines · Dan Carpenter

We should unlock here and also decrement the number of &map->users.

---
I'm not very familiar with this code. Please review carefully.

It looks right. -EINVAL is still returned so that is OK. Put it on the rc1 train.

Quoted 28 lines
drivers/xen/gntdev.c +3 -1
index 017ce60..b0f9e8f 100644
@@ -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
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
In reply to Dan Carpenter
Quoted 5 lines · Dan Carpenter

We should unlock here and also decrement the number of &map->users.

---
I'm not very familiar with this code. Please review carefully.

It looks right. -EINVAL is still returned so that is OK. Put it on the rc1 train.

Quoted 28 lines
drivers/xen/gntdev.c +3 -1
index 017ce60..b0f9e8f 100644
@@ -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
[email protected]
http://lists.xensource.com/xen-devel