[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] linux-2.6.18/blktap: ensure mmap() is called only once per region



Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/drivers/xen/blktap/blktap.c
+++ b/drivers/xen/blktap/blktap.c
@@ -635,6 +635,7 @@ static int blktap_release(struct inode *
 
        info->ring_ok = 0;
        smp_wmb();
+       info->rings_vstart = 0;
 
        mm = xchg(&info->mm, NULL);
        if (mm)
@@ -694,7 +695,13 @@ static int blktap_mmap(struct file *filp
                WPRINTK("blktap: mmap, retrieving idx failed\n");
                return -ENOMEM;
        }
-       
+
+       if (info->rings_vstart) {
+               WPRINTK("mmap already called on filp %p (minor %d)\n",
+                       filp, info->minor);
+               return -EPERM;
+       }
+
        vma->vm_flags |= VM_RESERVED;
        vma->vm_ops = &blktap_vm_ops;
 
@@ -746,6 +753,7 @@ static int blktap_mmap(struct file *filp
        /* Clear any active mappings. */
        zap_page_range(vma, vma->vm_start, 
                       vma->vm_end - vma->vm_start, NULL);
+       info->rings_vstart = 0;
 
        return -ENOMEM;
 }



Attachment: xen-blktap-map-once.patch
Description: Text document

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.