[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [linux-2.6.18-xen] privcmd: Take write lock on mm semaphore when calling
# 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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |