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

[Xen-changelog] [linux-2.6.18-xen] blktap: ensure mmap() is called only once per region



# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1325493442 -3600
# Node ID fe1adb19ffe1df656e2bdc0799d024b514159a7b
# Parent  80fc8882d7f9730a231ecba84f5fcf738fc94d27
blktap: ensure mmap() is called only once per region

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


diff -r 80fc8882d7f9 -r fe1adb19ffe1 drivers/xen/blktap/blktap.c
--- a/drivers/xen/blktap/blktap.c       Mon Jan 02 09:35:07 2012 +0100
+++ b/drivers/xen/blktap/blktap.c       Mon Jan 02 09:37:22 2012 +0100
@@ -635,6 +635,7 @@
 
        info->ring_ok = 0;
        smp_wmb();
+       info->rings_vstart = 0;
 
        mm = xchg(&info->mm, NULL);
        if (mm)
@@ -694,7 +695,13 @@
                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 @@
        /* Clear any active mappings. */
        zap_page_range(vma, vma->vm_start, 
                       vma->vm_end - vma->vm_start, NULL);
+       info->rings_vstart = 0;
 
        return -ENOMEM;
 }

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


 


Rackspace

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