aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen/xenfs/privcmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/xen/xenfs/privcmd.c')
-rw-r--r--drivers/xen/xenfs/privcmd.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/xen/xenfs/privcmd.c b/drivers/xen/xenfs/privcmd.c
index f80be7f6eb95..dbd3b16fd131 100644
--- a/drivers/xen/xenfs/privcmd.c
+++ b/drivers/xen/xenfs/privcmd.c
@@ -15,7 +15,6 @@
15#include <linux/mman.h> 15#include <linux/mman.h>
16#include <linux/uaccess.h> 16#include <linux/uaccess.h>
17#include <linux/swap.h> 17#include <linux/swap.h>
18#include <linux/smp_lock.h>
19#include <linux/highmem.h> 18#include <linux/highmem.h>
20#include <linux/pagemap.h> 19#include <linux/pagemap.h>
21#include <linux/seq_file.h> 20#include <linux/seq_file.h>
@@ -266,9 +265,7 @@ static int mmap_return_errors(void *data, void *state)
266 xen_pfn_t *mfnp = data; 265 xen_pfn_t *mfnp = data;
267 struct mmap_batch_state *st = state; 266 struct mmap_batch_state *st = state;
268 267
269 put_user(*mfnp, st->user++); 268 return put_user(*mfnp, st->user++);
270
271 return 0;
272} 269}
273 270
274static struct vm_operations_struct privcmd_vm_ops; 271static struct vm_operations_struct privcmd_vm_ops;
@@ -323,10 +320,8 @@ static long privcmd_ioctl_mmap_batch(void __user *udata)
323 up_write(&mm->mmap_sem); 320 up_write(&mm->mmap_sem);
324 321
325 if (state.err > 0) { 322 if (state.err > 0) {
326 ret = 0;
327
328 state.user = m.arr; 323 state.user = m.arr;
329 traverse_pages(m.num, sizeof(xen_pfn_t), 324 ret = traverse_pages(m.num, sizeof(xen_pfn_t),
330 &pagelist, 325 &pagelist,
331 mmap_return_errors, &state); 326 mmap_return_errors, &state);
332 } 327 }
@@ -384,8 +379,9 @@ static int privcmd_mmap(struct file *file, struct vm_area_struct *vma)
384 if (xen_feature(XENFEAT_auto_translated_physmap)) 379 if (xen_feature(XENFEAT_auto_translated_physmap))
385 return -ENOSYS; 380 return -ENOSYS;
386 381
387 /* DONTCOPY is essential for Xen as copy_page_range is broken. */ 382 /* DONTCOPY is essential for Xen because copy_page_range doesn't know
388 vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY; 383 * how to recreate these mappings */
384 vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY | VM_PFNMAP;
389 vma->vm_ops = &privcmd_vm_ops; 385 vma->vm_ops = &privcmd_vm_ops;
390 vma->vm_private_data = NULL; 386 vma->vm_private_data = NULL;
391 387