]> xenbits.xensource.com Git - people/royger/linux-2.6.18-xen.git/commitdiff
xen/x86: make __direct_remap_pfn_range()'s return value meaningful
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 13 Sep 2010 16:39:53 +0000 (17:39 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 13 Sep 2010 16:39:53 +0000 (17:39 +0100)
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>
arch/i386/mm/ioremap-xen.c

index 356f233691573667d746a0f31da0cc4def0ebbcf..4df793cdd818f602cac1dbb48bd3faea46f997d9 100644 (file)
@@ -45,7 +45,7 @@ static int __direct_remap_pfn_range(struct mm_struct *mm,
                                    pgprot_t prot,
                                    domid_t  domid)
 {
-       int rc;
+       int rc = 0;
        unsigned long i, start_address;
        mmu_update_t *u, *v, *w;
 
@@ -65,8 +65,8 @@ static int __direct_remap_pfn_range(struct mm_struct *mm,
                                                 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;
@@ -90,13 +90,9 @@ static int __direct_remap_pfn_range(struct mm_struct *mm,
                                         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();