Jan Beulich
2010-Sep-10 15:42 UTC
[Xen-devel] [PATCH] linux/x86: make __direct_remap_pfn_range()''s return value meaningful
From: Olaf Hering <ohering@novell.com> This change fixes the xc_map_foreign_bulk interface, which would otherwise cause SIGBUS when pages are gone because -ENOENT is not returned as expected by the IOCTL_PRIVCMD_MMAPBATCH_V2 ioctl. Signed-off-by: Jan Beulich <jbeulich@novell.com> --- a/arch/i386/mm/ioremap-xen.c +++ b/arch/i386/mm/ioremap-xen.c @@ -48,7 +48,7 @@ static int __direct_remap_pfn_range(stru pgprot_t prot, domid_t domid) { - int rc; + int rc = 0; unsigned long i, start_address; mmu_update_t *u, *v, *w; @@ -68,8 +68,8 @@ static int __direct_remap_pfn_range(stru direct_remap_area_pte_fn, &w); if (rc) goto out; - rc = -EFAULT; - if (HYPERVISOR_mmu_update(u, v - u, NULL, domid) < 0) + rc = HYPERVISOR_mmu_update(u, v - u, NULL, domid); + if (rc < 0) goto out; v = w = u; start_address = address; @@ -94,13 +94,9 @@ static int __direct_remap_pfn_range(stru direct_remap_area_pte_fn, &w); if (rc) goto out; - rc = -EFAULT; - if (unlikely(HYPERVISOR_mmu_update(u, v - u, NULL, domid) < 0)) - goto out; + rc = HYPERVISOR_mmu_update(u, v - u, NULL, domid); } - rc = 0; - out: flush_tlb_all(); _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel