Return value of IOCTL_PRIVCMD_MMAPBATCH is always 0
even if some entries are failed to map.
IMHO, ioctl should return any failure code.
It becomes a hotbed of bug.
Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
diff -r 65a419f81336 drivers/xen/privcmd/privcmd.c
--- a/drivers/xen/privcmd/privcmd.c Tue Feb 19 11:22:24 2008 -0700
+++ b/drivers/xen/privcmd/privcmd.c Thu Feb 21 20:01:32 2008 +0900
@@ -164,7 +164,7 @@ static long privcmd_ioctl(struct file *f
struct vm_area_struct *vma;
xen_pfn_t __user *p;
unsigned long addr, mfn, nr_pages;
- int i;
+ int i, rc;
if (!is_initial_xendomain())
return -EPERM;
@@ -187,6 +187,7 @@ static long privcmd_ioctl(struct file *f
return -EINVAL;
}
+ ret = 0;
p = m.arr;
addr = m.addr;
for (i = 0; i < nr_pages; i++, addr += PAGE_SIZE, p++) {
@@ -195,15 +196,16 @@ static long privcmd_ioctl(struct file *f
return -EFAULT;
}
- ret = direct_remap_pfn_range(vma, addr & PAGE_MASK,
+ rc = direct_remap_pfn_range(vma, addr & PAGE_MASK,
mfn, PAGE_SIZE,
vma->vm_page_prot, m.dom);
- if (ret < 0)
- put_user(0xF0000000 | mfn, p);
+ if (rc < 0) {
+ put_user(~(-1UL>>4) | mfn, p);
+ ret = rc;
+ }
}
up_write(&mm->mmap_sem);
- ret = 0;
}
break;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|