diff options
author | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2009-03-08 04:10:00 -0700 |
---|---|---|
committer | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2010-10-20 16:22:32 -0700 |
commit | f31fdf510531333dea95f0a92e6eaa1c3a7541e2 (patch) | |
tree | 0a722a5f3ddc104db0b2c57e8ee7f192626aa22f /drivers/xen/xenfs/privcmd.c | |
parent | 441c7416b55d3d48b4aaafc5bdd804092387d877 (diff) | |
download | op-kernel-dev-f31fdf510531333dea95f0a92e6eaa1c3a7541e2.zip op-kernel-dev-f31fdf510531333dea95f0a92e6eaa1c3a7541e2.tar.gz |
xen/privcmd: make sure vma is ours before doing anything to it
Test vma->vm_ops is our operations to make sure we created it.
We don't want to stomp on other random vmas.
[ Impact: bugfix; prevent ioctl from affecting other mappings ]
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Diffstat (limited to 'drivers/xen/xenfs/privcmd.c')
-rw-r--r-- | drivers/xen/xenfs/privcmd.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/xen/xenfs/privcmd.c b/drivers/xen/xenfs/privcmd.c index 6b602f5..80526af 100644 --- a/drivers/xen/xenfs/privcmd.c +++ b/drivers/xen/xenfs/privcmd.c @@ -310,6 +310,8 @@ static int mmap_return_errors(void *data, void *state) return 0; } +static struct vm_operations_struct privcmd_vm_ops; + static long privcmd_ioctl_mmap_batch(void __user *udata) { int ret; @@ -341,6 +343,7 @@ static long privcmd_ioctl_mmap_batch(void __user *udata) vma = find_vma(mm, m.addr); ret = -EINVAL; if (!vma || + vma->vm_ops != &privcmd_vm_ops || (m.addr != vma->vm_start) || ((m.addr + (nr_pages << PAGE_SHIFT)) != vma->vm_end) || !privcmd_enforce_singleshot_mapping(vma)) { |