[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [PRIVCMD] Fix ia64 domain creation by abstracting the singleshot mapping check.
# HG changeset patch # User kfraser@xxxxxxxxxxxxxxxxxxxxx # Node ID d2e6a7be622d306528074b62ea21d0b672ebd0ea # Parent 5297ced4d6102b08a890f9944eff98f3258e8eb5 [PRIVCMD] Fix ia64 domain creation by abstracting the singleshot mapping check. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> --- linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-) diff -r 5297ced4d610 -r d2e6a7be622d linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c --- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c Thu Oct 12 11:26:07 2006 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c Thu Oct 12 11:44:53 2006 +0100 @@ -34,6 +34,15 @@ static struct proc_dir_entry *privcmd_intf; static struct proc_dir_entry *capabilities_intf; + +static int privcmd_enforce_singleshot_mapping(struct vm_area_struct *vma) +{ +#ifndef HAVE_ARCH_PRIVCMD_MMAP + if (xchg(&vma->vm_private_data, (void *)1) != NULL) + return 0; +#endif + return 1; +} static int privcmd_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data) @@ -122,11 +131,9 @@ static int privcmd_ioctl(struct inode *i vma = find_vma(mm, msg.va); rc = -EINVAL; - if (!vma || (msg.va != vma->vm_start) || vma->vm_private_data) + if (!vma || (msg.va != vma->vm_start) || + !privcmd_enforce_singleshot_mapping(vma)) goto mmap_out; - - /* Mapping is a one-shot operation per vma. */ - vma->vm_private_data = (void *)1; va = vma->vm_start; @@ -190,13 +197,10 @@ static int privcmd_ioctl(struct inode *i if (!vma || (m.addr != vma->vm_start) || ((m.addr + (m.num<<PAGE_SHIFT)) != vma->vm_end) || - vma->vm_private_data) { + !privcmd_enforce_singleshot_mapping(vma)) { up_read(&mm->mmap_sem); return -EINVAL; } - - /* Mapping is a one-shot operation per vma. */ - vma->vm_private_data = (void *)1; p = m.arr; addr = m.addr; _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |