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-changelog

[Xen-changelog] [linux-2.6.18-xen] privcmd: Take write lock on mm semaph

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] privcmd: Take write lock on mm semaphore when calling
From: "Xen patchbot-linux-2.6.18-xen" <patchbot-linux-2.6.18-xen@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 10 Jul 2007 04:32:44 -0700
Delivery-date: Tue, 10 Jul 2007 04:30:58 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1184000854 -3600
# Node ID 21d5238ee2ec892825cc8905cc6ffa08b021fc88
# Parent  d36fd1c5db16e4531f78889a094fe0aeaa139995
privcmd: Take write lock on mm semaphore when calling
*remap_pfn_range(), as these function mess with fields in the vma
structure.
Signed-off-by: Christian Ehrhardt <ehrhardt@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>
---
 drivers/xen/privcmd/privcmd.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff -r d36fd1c5db16 -r 21d5238ee2ec drivers/xen/privcmd/privcmd.c
--- a/drivers/xen/privcmd/privcmd.c     Mon Jul 09 13:53:03 2007 +0100
+++ b/drivers/xen/privcmd/privcmd.c     Mon Jul 09 18:07:34 2007 +0100
@@ -112,7 +112,7 @@ static int privcmd_ioctl(struct inode *i
                if (copy_from_user(&msg, p, sizeof(msg)))
                        return -EFAULT;
 
-               down_read(&mm->mmap_sem);
+               down_write(&mm->mmap_sem);
 
                vma = find_vma(mm, msg.va);
                rc = -EINVAL;
@@ -154,7 +154,7 @@ static int privcmd_ioctl(struct inode *i
                rc = 0;
 
        mmap_out:
-               up_read(&mm->mmap_sem);
+               up_write(&mm->mmap_sem);
                ret = rc;
        }
        break;
@@ -177,14 +177,14 @@ static int privcmd_ioctl(struct inode *i
                if ((m.num <= 0) || (nr_pages > (LONG_MAX >> PAGE_SHIFT)))
                        return -EINVAL;
 
-               down_read(&mm->mmap_sem);
+               down_write(&mm->mmap_sem);
 
                vma = find_vma(mm, m.addr);
                if (!vma ||
                    (m.addr != vma->vm_start) ||
                    ((m.addr + (nr_pages << PAGE_SHIFT)) != vma->vm_end) ||
                    !privcmd_enforce_singleshot_mapping(vma)) {
-                       up_read(&mm->mmap_sem);
+                       up_write(&mm->mmap_sem);
                        return -EINVAL;
                }
 
@@ -192,7 +192,7 @@ static int privcmd_ioctl(struct inode *i
                addr = m.addr;
                for (i = 0; i < nr_pages; i++, addr += PAGE_SIZE, p++) {
                        if (get_user(mfn, p)) {
-                               up_read(&mm->mmap_sem);
+                               up_write(&mm->mmap_sem);
                                return -EFAULT;
                        }
 
@@ -203,7 +203,7 @@ static int privcmd_ioctl(struct inode *i
                                put_user(0xF0000000 | mfn, p);
                }
 
-               up_read(&mm->mmap_sem);
+               up_write(&mm->mmap_sem);
                ret = 0;
        }
        break;

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [linux-2.6.18-xen] privcmd: Take write lock on mm semaphore when calling, Xen patchbot-linux-2.6.18-xen <=